Home > Back-end >  Long clientsocket how to maintain a permanent connection?
Long clientsocket how to maintain a permanent connection?

Time:12-04

Please comment, clientsocket how to keep a long connection? Now find if you don't send data interaction, will automatically be disconnected, is there any place can be set up, as long as the connection is established, it will not automatically disconnect, even if accidental disconnection, also automatic reconnection,

CodePudding user response:

Often hear people say the heart mechanism, regularly send a packet to reply to confirm again, if received several times that connection has been disconnected, reconnect,

CodePudding user response:

Is clientsocket controls? Controls for attribute set, if the API, seems there is no automatic disconnect the provisions of the so-called automatic turnoff, more may be intermediate nodes (such as switches, firewall) as zombies connect and disconnect, if you want to solve the problem of automatically disconnect, just get a regular brush sense data sent heartbeat, switch won't disconnect your connection, as for automatic reconnection, that is about to heart + confirm, don't get reply reconnection,
  • Related