Building Multi threaded TCP/IP Server

前端 未结 7 2011
我在风中等你
我在风中等你 2021-02-08 03:42

I wanna build a TCP/IP server that will be used by up to 100 concurrent clients, but still not sure how to get started.

at least I need the server to this:

7条回答
  •  粉色の甜心
    2021-02-08 04:25

    100 sockets isn't that many. You could go to all the trouble of using something like epoll(), but for this case I'd just set up a single FD_SET with all the sockets, select() on the entire set, then check each one, and process them in sequence. If I had to do something that was potentially time-consuming, I'd use a thread pool for the message handlers.

提交回复
热议问题