Home > Back-end >  C socket to disconnect reconnection
C socket to disconnect reconnection

Time:11-01

Problem: client and server to transmit data, the connection is broken, the client through the connect () connect the server, why don't connect, the server didn't respond?
Everybody encountered such a problem? Help to think about here may be a problem

CodePudding user response:

After disconnecting, want to shut off the socket, then reconnection,

CodePudding user response:

If it is abnormal disconnection, server-side link state and normal state, the client focus on the new link, require explicit Colse/Free socket, can use Wireshark to look at specific network behavior

CodePudding user response:

The service side shall have the ability to identify and connection state management, such as active bolt on a regular basis, with the user do not allow the reconnection,
If the server service only one client, consider exclusion method, there is a connection to accept new connections out old connection,

CodePudding user response:

When the client disconnects, the service side should not disconnect, belong to the state of half a connection, should wait after the server disconnected in the reconnection,

CodePudding user response:

The client is relatively fixed,
Often connect + heartbeat packets + client identification + client automatic reconnection
Such solution resources occupy less, reliable operation,
  • Related