阅读背景:

获取NIO.2服务器中客户端IP地址的列表

来源:互联网 

In a server based on AsynchronousServerSocketChannel and AsynchronousSocketChannel, how can I check whether a connection from a given IP address already exists? I want to send a specific message to connections that come from an IP address that is already connected (asking it to try again later; I'm dealing with very specific client-side LANs whose bandwidth will be poorly utilized if shared rather than forced to serialize by the server). However, I see no way to get a list of IP addresses to search for whether the same IP address already has a connection. Is there a more elegant/efficient way to do this other than inserting the IP addresses of each new connection to (and removing them upon closing from) something like a ConcurrentSkipListSet?In a server based on AsynchronousServerSocketCh




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: