Sockets: Too many open files on a sequent under dynix

Curt Welch curt at oasys.dt.navy.mil
Tue Apr 23 15:30:37 AEST 1991


cluther at supernet.dallas.haus.com (Clay Luther) writes:
>I do not usually read this group, so please email replies to me at
>cluther at supernet.haus.com *or* cluther at ponder.csci.unt.edu.  Thanks.

You know, I hate it when people do this.  If you care enough to post
a message, can't you at least read the news group for the next week?

>I have begun to think that the sequent is charging 2 files, one for input and
>one for output, for each telnet connection to the program.  Is this true?

If the code is using pseudo ttys for each connection, then yes, it could use
2 (or maybe even 3) files for each connection.

Normal TCP connections (socket(), connect()) to daemons only take one
file descriptor per connection.  (and only cost 1 unit out of 20).

>And if so, are there any work arounds, or will I have to restrict the maximum
>number of users my program can handle at one time due to a kernel limitation?

I'd say your probably have a bug in your code.  Write some debug code to
test all the file descriptors from 1 to 20 when you get the too many files
error.  Do an fstat() on all file descriptors and print out the results.
This will tell you how many files you have open and what they are.  Once
you see this output, you will probably be able to understand what the
program is doing.

If all else fails, use setdtablesize(2) to get around your problem.

Curt Welch



More information about the Comp.unix.programmer mailing list