How to send message using nio directly without client send me message firstly

I learn nio now, but I don't know how to send message without client send me message firstly after it connected with server. I try to cache SelectionKey and SocketChannel, but it does'n t work. So how can I solve this problem. Thanks.


I solved the problem,there are two methods selectKeys and keys, selectKeys can get all channels that receive an action. keys can get all channels that connect with server, I can use keys method to send message directly.

链接地址: http://www.djcxy.com/p/34144.html

上一篇: 针对PHP应用程序的异步/企业消息传递

下一篇: 如何在没有客户端的情况下直接使用nio发送消息