The Winsock function listen(socket, backlog) has a parameter to specify the size of the queue for pending connections. The program should pass SOMAXCONN to set the queue to its maximum size.
Question: What is the maximum queue size for each Windows version: 2000, XP, Vista, 7?
Thanks!
Reference: listen() on MSDN Library
It was 5 back on NTWS 4.0: http://support.microsoft.com/kb/127144
I believe in XP it was also this way, although from XP on it's hard to find anything concrete from Microsoft. (At least for me, that is how I ended up here hoping for an actual answer).
A quick seat-of-the-pants Java test showed that the default for Windows 7 Pro is 50, and the limit is 200. FWIW.
I'm not sure why someone would answer this with an assumption about why the question is asked. There are legitimate reasons for knowing the actual answer.
For example, you have software where you may receieve a burst of requests. If the max backlog by the operating system is 5, you may end up refusing connections even if handing them off as quickly as possible. And a backlog of 200 alleviates this. And because of this, you may want to make a OS system requirement to not use an OS that has such a backlog limitation.
The backlog parameter of the listen(socket, backlog) function is limited to SOMAXCONN
. If set to SOMAXCONN
, the underlying service provider responsible for the socket will set the backlog to a maximum reasonable value1.
The maximum value on Windows platforms was2:
SOMAXCONN = 5
. Winsock 1.1 was part of Windows 95 and Windows NT 3.5.SOMAXCONN = 0x7fffffff
and limits the listen backlog to a large value (typically several hundred or more). Winsock 2.1 was an add-on to Windows 95 and part of Windows 98, Windows NT 4.0 and all subsequent Windows releases.SOMAXCONN_HINT(N)
can be used to set the backlog to a larger value than possible with SOMAXCONN
. The backlog value will be N, adjusted to be within the range (200, 65535)1.Note:
"When calling the listen() function in a Bluetooth application, it is strongly recommended that a much lower value be used for the backlog parameter (typically 2 to 4), since only a few client connections are accepted. This reduces the system resources that are allocated for use by the listening socket. This same recommendation applies to other network applications that expect only a few client connections."1
Sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With