我正在用 Java 编写一个 BASIC NIO 程序,
ServerSocketChannel serverChannel = ServerSocketChannel.open( );
ServerSocket serverSocket = serverChannel.socket( );
Selector selector = Selector.open( );
serverSocket.bind (new InetSocketAddress (1234));
serverChannel.configureBlocking (false);
serverChannel.register (selector, SelectionKey.OP_ACCEPT);
当我执行以下操作时
int n = selector.select();
它从来没有从这个语句中出来,我可以指定 Timeout 值,每次 n 的值为 0 时都这样做