Assume that the Server end judges the disconnection of the Client:
1) Client Close Socket, this is normal, Server segment RECV returns 0, and Server is closing Socket. 2) Network Disconnect, need Keepalive's online maintenance, TCP default Keepalive time is 7200 seconds, long time; you can also in the TCP data stream, you can set online in the TCP stream, but this requires TCP stream It can be removed; or a Keepalive package occurs in OOB, and 1Byte's Keepalive package is timed. 3) The client program is abnormally exiting, and the system should turn off all file descriptors to release resources.