How many sockets can I get from accept()?

Eric Norum eric.norum at usask.ca
Mon Feb 18 15:08:45 UTC 2002


Sergei Organov wrote:
> 
> Hello,
> 
> In my application 6'th invocation of accept() on a socket starts to just
> return -1 after 5 connections have been already accepted and not yet
> closed. As soon as I close one of previously accepted connections, accept()
> returns to its normal operation. Is 5 connections an arbitrary limit and if
> so, where it is defined?
> 
> BR,
> Sergei.

Did you check the value of errno after the failing calls?  My guess is
that you're hitting the limit of maximum open file descriptors.  This is
a simple confdefs.h parameter:

#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 50

You could perhaps be running out of mbufs, too.   Check the errno -- it
should help you find the problem.

-- 
Eric Norum                                 eric.norum at usask.ca
Department of Electrical Engineering       Phone: (306) 966-5394
University of Saskatchewan                 FAX:   (306) 966-5407
Saskatoon, Canada.



More information about the users mailing list