[fpc-pascal]unix tcp server - filedescriptors problem

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Mon Dec 9 17:28:03 CET 2002

On Mon, 9 Dec 2002, Karagiannidis Savvas wrote:

> 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...

This is normal. The solution to this should be a call to setsockopt()
with the SO_REUSEADDR option.


More information about the fpc-pascal mailing list