saransk 22.01.2012 08:01 QIP

Early versions of winsocket's select only supported waiting for a maximum of 64 handles (probably owning to the fact that all windows kernels can only wait for 64 things at the same time internally; Microsoft recommends spawning a chain of threads and wait for 63 handles and the previous thread in each. Sounds great!).

Newer versions support more handles, but you need to define FD_SETSIZE to some high number (e.g. 2048) before compiling the winsocket select call (which might be in libev or elsewhere, for example, perl and many other interpreters do their own select emulation on windows).

Another limit is the number of file descriptors in the Microsoft runtime libraries, which by default is 64 (there must be a hidden 64 fetish or something like this inside Microsoft). You can increase this by calling _setmaxstdio, which can increase this limit to 2048 (another arbitrary limit), but is broken in many versions of the Microsoft runtime libraries. This might get you to about 512 or 2048 sockets (depending on windows version and/or the phase of the moon). To get more, you need to wrap all I/O functions and provide your own fd management, but the cost of calling select (O(n²)) will likely make this unworkable.

Do you really want to delete ?