Many people over the years have asked:
Why can’t I open more than (number usually varies from 3970 to 3974) sockets on Windows?
My response:
You have run into the ephemeral port limit on Windows. Windows versions through XP and Server 2003 use a port range of 1024 though 5000 for ephemeral, or short-lived, ports. These ports are the ones used if you call bind() on a socket and pass zero as the port number, allowing Windows to assign a port for you. This limit is not normally a problem, but usually manifests when testing the limits of programs. In HawkNL I provide my own bind() which uses 1024 through 65535. There is also a registry modification which can increase the range.