Windows network connections limit?
Is there any limit imposed by Windows on the number of concurrent network connections to a given TCP socket?
If so, does Windows Server 2003 differ on this aspect from Windows XP (or Vista)?
The problem behind this question is the design of a server application which is supposed to listen on a given TCP port and establish connections with incoming clients. The number of connected clients at the same time should be in the order of hundreds, up to a thousand.
So, given that all the remaining scalability issues are under control, would Windows itself impose a limit on the number of available concurrent connections? Would Windows Server 2003 offer anything extra that the regular Windows don't offer in this case?
[749 byte] By [
jhrecife] at [2007-11-20 8:53:51]

# 1 Re: Windows network connections limit?
You need a different port for each connection, and there are only so many 16-bit unsigned port numbers (1-65535)
W2K3 has concurrent licensing for Terminal Server, but that's not the same thing.
# 2 Re: Windows network connections limit?
You need a different port for each connection, and there are only so many 16-bit unsigned port numbers (1-65535)
Actually, on the server side, all connections are established using the exact same (single) port. The number of available ports is an issue only on the client side.
But naturally, even on the server side, each connection will consume some amount of resources. So there will be a limit on the number of incoming TCP connections that can be serviced. If you use an IOCP architecture, that limit will probably be somewhere north of one or two thousand concurrent connections, on an XP machine equipped with today's typical amounts of memory, CPU speed etc.
Note that you will not be able to achieve these numbers if you do not use IOCP as your architecture.
Mike
# 3 Re: Windows network connections limit?
Alright then, so if I understood correctly, the limit of connections that can be handled on the server side only depends on the amount of resources of my server machine.
Windows itself has no limits of this kind and from this point of view there is no difference between the currently available Windows versions (XP, Vista, Server 2003), correct?
# 4 Re: Windows network connections limit?
Would Windows Server 2003 offer anything extra that the regular Windows don't offer in this case?
I think so.
If you have, say, an internal network with computers accessing each others harddrives via Windows Explorer then the maximum number of connections to each individual Windows XP computer is (around) 10. If you want more connections then you need to use one of the server editions of Windows. I would have thought that also applies to TCP/IP connections.
# 5 Re: Windows network connections limit?
I would have thought that [10 connection limit] also applies to TCP/IP connections.
It doesn't. The 10-connection limit only applies to services, not sockets.
Mike
# 6 Re: Windows network connections limit?
The server LISTENS on the same port to make a connection, but it assigns each unique identification to a port, which would then listen.
i.e. Chat App
# 7 Re: Windows network connections limit?
The server LISTENS on the same port to make a connection, but it assigns each unique identification to a port, which would then listen.
I think you are saying that the server listens on one port, but that when a new connection is accepted, the new connection is handed over to another port.
If this is what you are saying, then I continue to disagree. The server handles all connections on exactly the same port.
You can confirm this for yourself with a simple test. Browse to a content-rich site like www.msn.com and then run "netstat -an" from a command prompt, to see the network connections that have been established. A content-rich site is best because then your browser will establish multiple connections to the site. The "local address" column of netstat (which will include the multiple connections made to the site by your browser) will each have a different port number, which proves that each new connection opened by a client will have a new and different port number. But in the "foreign address" column, the target site will always have exactly the same port number, which proves that a server handles all connections over the same port number.
Mike
# 8 Re: Windows network connections limit?
The confusion might be that for most common services, the CLIENT will use a random port (or at least a range of ports) to communicate with the standard service port on the server.
The server service can then accept as many requests on that SINGLE port as it can handle, or is configured to handle.
The other thing is that generally only one service can be bound to a single port. This would mean that any other service would have to pick a different port to listen on. But again, a service bound to any single port can accept as many connections as it is designed to handle.
# 9 Re: Windows network connections limit?
The desktop versions do indeed have hardcoded inbound limits.
No, they don't.
The Winsock FAQ, which is many years old, reports 16,000 simultaneous connections on Win NT 4.0. See http://tangentsoft.net/wskfaq/advanced.html#maxsockets
Mike
# 10 Re: Windows network connections limit?
Bah, I see where I tripped myself up.
Let's try that last sentence again:
The SERVER SERVICE, in Windows 2000/xp desktop OS's has a hardcoded 10 (or even 5) connection limit.
The 3rd party services you have running on your server (desktop, whatever) can accept as many connections as they can handle.
Ok, better.
# 11 Re: Windows network connections limit?
Yep, better ;)
Mike