Maximum ports

Peter Arremann loony at loonybin.org
Fri Jan 13 19:30:40 UTC 2006


On Friday 13 January 2006 12:51, vi wrote:
> I was interested to know how many ports can be opened on Fedora Linux FC4.
> I did an experiment. I wrote a server program that accepts TCP connections
> and a client program that keeps connecting to the Server port.
>
> Guess the results? The server program can have about 1020 port maximum
> only. Is that not low for a server expected to be used by millions. Windows
> XP professional with SP2 can open about 3000 ports maximum.
You're running into resouce limit issues. Ulimit -n will show you the limit 
for files you're allowed to have open (a socket counts as a file as well in 
unix). Ulimit can't change that value though on most systems (and on those 
that it can, it usually can only decrease it unless you're root). By default 
its set to 1024 on most platforms. use sysctl to change that. 
>From inside your program you can use getrlimit/setrlimit to change the 
resource limits

Peter.




More information about the users mailing list