Click to See Complete Forum and Search --> : Windows network connections limit?
jhrecife
June 27th, 2007, 04:00 PM
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?
dglienna
June 27th, 2007, 04:15 PM
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.
MikeAThon
June 27th, 2007, 08:26 PM
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
jhrecife
June 28th, 2007, 03:40 PM
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?
Zaccheus
June 28th, 2007, 04:56 PM
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.
MikeAThon
June 28th, 2007, 06:55 PM
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
dglienna
June 28th, 2007, 08:28 PM
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
MikeAThon
June 28th, 2007, 08:57 PM
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
Craig Gemmill
June 29th, 2007, 12:23 AM
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.
MikeAThon
June 29th, 2007, 01:12 AM
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
Craig Gemmill
June 29th, 2007, 04:03 PM
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.
MikeAThon
June 29th, 2007, 07:49 PM
Yep, better ;)
Mike
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.