When I code like this:
ServerSocketChannel ssc = ServerSocketChannel.open();
InetSocketAddress sa = new InetSocketAddress("localhost",8888);
ssc.socket().bind(sa);
ssc.configureBlocking(false);
ssc.socket().accept();
the ServerSocket.accept()
method throws java.nio.channels.IllegalBlockingModeException
. Why can't I call accept()
, even though I set blocking to false
?