Q:

Localhost connection closed not detected with select

I design a little web server in C winapi.
I use select to detect a 'connection closed' from the localhost (Firefox).
I launch a request with Firefox on my local server, and my software wait until I close the connection with Firefox (stop button).
If I close the connection from Firefox after about ten seconds, my software is able to detect the connection closed.
But, if I close the connection after one minute, my software doesn't detect anything...
ONLY, when I close Firefox, the connection closed is finally detected or ... finally closed by firefox ?!

A:

Detection of the closing of a socket can be very dependent on how/why the socket was closed along with other characteristics of the connection. I've found that one way to detect a closed connection in a reasonable amount of time is to attempt to write to the connection (as in establishing a periodic poll in both directions). That should result in an immediate error. 
How this helps in your particular case, I'm not sure.

