[fpc-pascal]unix tcp server - filedescriptors problem

Peter Vreman peter at freepascal.org
Mon Dec 9 17:22:12 CET 2002

> I noticed, that when a tcp server accepts a connection and finally the
> connection is closed, either when the client disconnects, or the server
> closes the connection, there remains a file descriptor open! Using lsof,
> or in /proc/(processID)/fd, I can see the file descriptor. At first I
> thought that the file descriptor whould be there, as long as the
> connection would be in TIME_WAIT state, but I was wrong.
> Is this behaviour normal?
> If the server accepts connections at fast rates, then the result is Too
> many open files Errors...
> I only use one process to handle multiple client connections. I wanted to
> confirm it and used a very simple similar program and the result is the
> same...
> Here is the code I used to confirm it...

Try adding a close of the socket fd after the shutdown:


More information about the fpc-pascal mailing list