I have a very regular server application. It uses TCP, listen() to a public port, select() file descriptor set and accept() new connections. At the same time, it maintains all these client connections.
Sometimes, the clients may close their connection without informing the server, like power off the PC, kill the application.
Now my question is:
How can the server side detect those closed connections safely and precisely ?
Actually, this application is running on NT and it uses winsock. But it is ported from Unix and asynchronous functions are not used. So all the functions are still BSD socket functions. I know I can solve this problem by checking WM_CLOSE message on the socket. But we don't want to change the code at this time. So I guess it is better to ask Unix expert to answer this question.
Thanks in advance.