当我这样编码时:
ServerSocketChannel ssc = ServerSocketChannel.open();
InetSocketAddress sa = new InetSocketAddress("localhost",8888);
ssc.socket().bind(sa);
ssc.configureBlocking(false);
ssc.socket().accept();
该ServerSocket.accept()
方法抛出java.nio.channels.IllegalBlockingModeException
. 为什么我不能打电话accept()
,即使我将阻止设置为false
?