open file descriptors

From: santoshjoseph73 (member45873_at_dbforums.com)
Date: 10/27/03


Date: Mon, 27 Oct 2003 14:35:17 -0500


I think this question has been posted before, but I don't think the
answers were clear.

The problem I have is I'm running a server on unix(solairs 2.7) and i'm
running out of sockets. I use the setulimit function like this

      new_res.rlim_cur = res.rlim_max;

      new_res.rlim_max = res.rlim_max;

      if ( -1 == setrlimit(RLIMIT_NOFILE, &new_res) )

         return 0;

and this sets the open file descriptor limit to 1024. The question what
should I do when I get a socket error on a accept and the error is
EMFILE (Too many open files).

Should I sleep for a bit (1 second) and retry the accept? But what
happened the connection that was being tried did it fail (so the client
would get an error?)

And how can I avoid this type of situation? Can I find out how many
open file descriptors are currently being used (in code) so I avoid
accepting new connections?

How do Unix web servers solve this problem?

Thanks,

-Santosh

--
Posted via http://dbforums.com


Relevant Pages

  • Re: can recieve mail but cant send
    ... The connection to the server has failed. ... Subject '', Account: ... 25, Secure: No, Socket Error: 10060, Error Number: 0x800CCC0E ...
    (microsoft.public.windows.vista.mail)
  • Re: can not send email
    ... The connection to the server has failed. ... Subject 'Follow up', Account: ... Secure: Yes, Socket Error: 10060, Error Number: 0x800CCC0E ...
    (microsoft.public.windows.vista.mail)
  • Re: Problems with Windows Mail...
    ... Windows help -www.rickrogers.org ... "Server unexpectedly terminated the connection... ... socket error 10053 ...
    (microsoft.public.windows.vista.general)
  • Re: OE6 cannot connect to mail server after login change
    ... The connection to the server has failed. ... Account: 'mail.labyrinth.net.au', Server: 'mail.labyrinth.net.au', Protocol: POP3, Port: 110, Secure: No, Socket Error: 10061, Error Number: 0x800CCC0E ... When the mail connection does work, changing Nortons makes no difference also. ... My other settings aren't anything special as far as I can tell, POP3, the right ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Can receive email via Windows Mail but cannot SEND
    ... office to bedroom office - but same wireless connection has been used the ... The connection to the server has failed. ... 25, Secure: No, Socket Error: 10061, Error Number: 0x800CCC0E ...
    (microsoft.public.windows.vista.mail)