PDA

View Full Version : number of concurrent tcp connections



Googler
April 17th, 2008, 09:50 PM
i'm building a c++ TCP server under ubuntu
the problem is that it can't serve more than 1023 concurrent connection
so is there a way to make this number much more bigger?

thanks in advance

stroyan
April 18th, 2008, 06:33 AM
You are probably making all of the tcp connections from one process and hitting the default limit on number of open files per process.
You can confirm that limit with 'ulimit -a' or 'ulimit -n' at a shell prompt.
You could increase that limit with 'ulimit -n <number>' or setrlimit() as root or by editing /etc/security/limits.conf .

Googler
April 20th, 2008, 01:21 PM
You could increase that limit with 'ulimit -n <number>' or setrlimit() as root or by editing /etc/security/limits.conf .

after editing limits.conf the tcp server hangs up and refuse to accept more than 1023 connections

any other solutions

stroyan
April 20th, 2008, 06:46 PM
You could use the strace command to record the parameters and results of system calls made by your program.
That would give more information about what resource limit the program was reaching.