Jump to ID:
Networking

Project Home

Discussions

Wiki

Project Info
Forum Topic - unable to create more than 995 sockets filedescriptors: Page 1 of 5 (5 Items)
   
 
 
unable to create more than 995 sockets filedescriptors  
hi

my program creates a number of active sockets transmitting data to a server at periodic intervals. I get the error 

socket error : Too many open files // errno 24 EMFILE
( this happens at the 996th socket call )

when i try to create about a 1000 connections at the client side.
well i did check out the the ulimit which was set to 1000.
so i increased it up to 2000 using the ulimit -n 2000 command.

apart form that i also used the call setrlimit(RLIMIT_NOFILE, &curr_limits) where curr_limits contains  2000 for both 
soft n hard limit.
the next call getrlimit returns 2000 for both.

but still in the next run i get the same error at the 996th socket call again.

i tried the getconf _SC_OPEN_MAX  it still showed 1000 as the o/p despite the ulimit showing 2000 as the limit.

any of u guys have a  idea as to what may be wrong or how to increase the fd limit.

regards,
Rosen.