SelectionKey.attachment() returns null
写NIO程序的时候遇到了SelectionKey.attachment()为空的问题,最后解决了,这里简单介绍下,希望能对其他人有帮助:
SelectionKey key = socketChannel.register(selector, SelectionKey.OP_CONNECT);
key.attach(group);
...
client.registe...
原创
2011-09-17 15:49:36 ·
1327 阅读 ·
0 评论