NagaNIO类库封装包
Naga是一个非常小的NIO类库。提供封装Socket和ServerSocket的几个Java类。
服务端示例代码:
NIOService service = new NIOService;
NIOServerSocket serverSocket = service.openServerSocket(1234);
serverSocket.setConnectionAcceptor(myAcceptor);
serverSocket.listen(myObserver);
客户端示例代码:
NIOService service = new NIOService;
NIOSocket serverSocket = service.openSocket("www.google.com", 1234);
socket.listen(myObserver);
// Asynchronous write by default:
socket.write("Some message".getBytes());
评论