Logo

Hawk Software

Programming, web design, and more

Recent Posts

Category

Archives

Meta

Ask Phil – 3970 socket limit on Windows?

Programming 2 Comments

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.

2 Responses to “Ask Phil – 3970 socket limit on Windows?”

  1. sarp Says:

    http://smallvoid.com/article/winnt-tcpip-max-limit.html

  2. Phil Frisbie, Jr. Says:

    Thanks for another link that shows how to modify the registry to increase the port range, and more!

Leave a Reply