How many TCP connections can a server keep?

Started by
8 comments, last by Robinhood 19 years, 10 months ago
Who can told me how many TCP connections can a server keep?
Advertisement
I''ve seen a 2000 server machine with about 2000 connections open, but it was under controlled conditions. Usually the limit is 64 per thread. You can keep adding threads, but eventually you will run out of system resources.
Mainly depends on system resources, but the theoretical limit is the maximum of an unsigned int, which is used to specify the port number: 65535 or so.

daerid | Legends | Garage Games | Spirit | Hapy | Boost | Python | Google
"Doomed to crumble, unless we grow, and strengthen our communication" - Maynard James Keenan, Tool
daerid@gmail.com
Unsigned short you mean.
I mean socket
quote:Original post by Matei
Unsigned short you mean.


Highly offtopic.. but:

16 bits, you and daerid mean.





In fact there is no real practical limit.

They aren''t limited by 65535 ports, as with server connections, several can use the same port.

It just depends really on whether the server has time to process the commands etc.

You might need to tune the OS for large numbers.

Mark
quote:Original post by daerid
Mainly depends on system resources, but the theoretical limit is the maximum of an unsigned int, which is used to specify the port number: 65535 or so.


That''s for making connections. You can listen to one port (eg. 80, http) and accept as many incoming connections as you like. A webserver can have thousands of connections open, all on port 80.
Can you explain how to implement listening to a port and accepting as many connections as I like?
You can use the select function to set up a non-blocking server, which is probably what you want.

This topic is closed to new replies.

Advertisement