Home > other >  Application in the case of the socket is not close to exit, the operating system or server how to de
Application in the case of the socket is not close to exit, the operating system or server how to de

Time:12-03

Premise is: TCP connections,
My program is the client, the MFC to write, when the program exits with PostQuiteMessage (1), but forget to call the client socket before exit the close () function, there is no call destructor, no release resources, withdrew,

Excuse me:
1, the operating system will help the close? Delay mechanism?
2, the service side how to deal with over there? Delay mechanism?

CodePudding user response:

1. The process exits, system recovery socket.
2. The service side usually customer immediately disconnected, but there are not immediately know, will be through the heartbeat mechanism check connection timeout, overtime as disconnected,
  • Related