Java NIO创建步骤
NIO创建过程一、打开ServerSocketChannel,用于监听客户端的连接 1ServerSocketChannel acceptSvr = ServerSocketChannel.open(); 二、绑定监听端口,设置连接为非阻塞模式 12acceptSvr.socket().bind(new InetSocketAddress(InetAddress.getByName("IP"),port));accptSvr.configureBlocking(false); 三、创建Reactor线程,创建多路复用器并启动线程 12Selector selector = Selector.open();new Thread(new ReactorTask()).start();