Socket - handling large numbers of incoming connections

Jakob Jenkov via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 21 11:51:07 PST 2015


What is the fastest / most scalable way to implement a server 
(using a Socket) which can handle large numbers of incoming 
connections? Like, at least 10K, but probably up to 1 million 
connections.

More specifically:

1) How do I efficiently select the connections (client Socket 
instances) which have data which is ready to read?

2) How do I efficiently select the connection that are ready to 
accept data sent to them?
(which are write ready - in other words) ?


I read in the D Cookbook that using the SocketSet is not the 
fastest way to do this, as it has to iterate through all Socket 
instances in it, and check a flag on each Socket.


More information about the Digitalmars-d-learn mailing list