Catalyst Knowledge Base

Maximum Number of Windows Sockets Connections

Document ID: 100072
Products: SocketWrench, All Platforms
Last Reviewed: January 15, 2006

Summary

This article discusses the maximum number of sockets that can be created on the various Windows platforms.

More Information

The total number of sockets that can created using the SocketWrench control or library varies, based on the operating system platform. Additionally, SocketWrench 3.6 and earlier versions had an internal limit of 1000 open sockets per process. This limitation does not exist in version 4.0 and later releases.

Client Platforms
For Windows 95, Windows 98 and Windows ME, the default number of sockets that may be created system-wide is 100. While this is typically sufficient for client applications, the number of available sockets may be exhausted by server programs. To increase this value, it requires that you use the RegEdit.exe utility to modify the following registry value:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\MaxConnections

On Windows 95, this value is a DWORD while on Windows 98 and Windows ME it is a string value. It is important to note that these versions of Windows were not designed to act as server platforms. Increasing this value beyond 300 is not recommended, as it may cause the system to become unstable.

For Windows NT based systems, client applications will be automatically assigned local port numbers between 1024 and 5000. This means that if one or more clients establish a large number of connections, or rapidly connect and disconnect from a server, all of the ports in that range may be allocated. This creates a practical limit of 3976 client connections system-wide, either active or in the time-wait state. To increase the number of ports available, use the RegEdit.exe utility to select the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Create or modify a DWORD value called MaxUserPort, and specify the maximum port number that you wish to use. Valid values range from 5000 to 65534, with a default value of 5000.

Server Platforms
On Windows NT, Windows 2000, Windows XP and Windows 2003 Server, sockets are allocated from the non-paged memory pool so the actual number of sockets that can be created system-wide depends on the amount of physical memory that is installed. The non-paged memory pool is 1/8th the size of physical RAM, with a maximum of 128Mb on Windows NT and 256Mb on Windows 2000 and later platforms. The theoretical maximum for Windows NT servers is approximately 12,000 sockets, and 25,000 for Windows 2000 and later versions. In practical terms, it is safe to estimate that the Windows Server platforms can allocate approximately 4,000 sockets for every 512Mb of physical memory. For Windows NT, this means that the maximum number of sockets will be around 8,000 for a system with 1Gb or more of RAM. For Windows 2000 and later versions, the maximum number of sockets is around 16,000 for a system with 2Gb or more of RAM.

References

Microsoft Article 196271: Unable to Connect from TCP Ports Above 5000

Feedback
Please tell us how useful this article was in answering your question:
Not Answered Partial Answer Completely Answered

Let us know if you have any feedback on how this article could be improved,
or suggestions for additional Knowledge Base articles:
Email Address:
If you would like a response to your feedback, please provide your email address