Building Multi threaded TCP/IP Server

前端 未结 7 2120
我在风中等你
我在风中等你 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:17

    On a Windows platform you are probably best to avoid select for large numbers of concurrent connections (100 isn't a large number of connections though). However, avirtuos is correct in that you want to avoid any 'thread per connection' models. The most efficient approach on Windows is to use overlapped I/O and I/O Completion Ports. This allows you to manage 10s of thousands of connections with a small number of threads (2 or 3, perhaps).

    I don't have any Delphi experience so I've no idea how easy it is to interact with C++ code BUT I have a free C++ I/O Completion Port server framework (available from here) that would, at least, show you how the standard Win32 I/O Completion Port API operates. It might be useful to you and you might be able to do something similar in Delphi.

提交回复
热议问题