Polling over thousands of TCP sockets

♀尐吖头ヾ 提交于 2019-12-05 10:18:47

Try using Socket's high performance API which allows simultaneously receiving data on a very large number of sockets, without using one thread per socket. At the bottom of the article there's a link to a complete sample. There's also a sample in the MSDN article for the SocketAsyncEventArgs class.

Why not populate a queue with the addresses you need to poll and have your thread pool take items off the queue to process?

Once you are done with an item push it to the back of the queue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!