NIO类库封装包 Naga
jopen
13年前
<div id="p_fullcontent" class="detail"> <p>Naga是一个非常小的NIO类库。提供封装Socket和ServerSocket的几个Java类。</p> <p>服务端示例代码:</p> <pre class="brush:java; toolbar: true; auto-links: false;">NIOService service = new NIOService; NIOServerSocket serverSocket = service.openServerSocket(1234); serverSocket.setConnectionAcceptor(myAcceptor); serverSocket.listen(myObserver);</pre> <p>客户端示例代码:</p> <pre class="brush:java; toolbar: true; auto-links: false;">NIOService service = new NIOService; NIOSocket serverSocket = service.openSocket("www.google.com", 1234); socket.listen(myObserver); // Asynchronous write by default: socket.write("Some message".getBytes());</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326295672765" target="_blank">http://www.open-open.com/lib/view/home/1326295672765</a></p> <p></p> </div>