Home > Software engineering >  Consult the server-side KEEPALIVE time problem
Consult the server-side KEEPALIVE time problem

Time:11-10

Ask a question, after the client socket connection server, the server set up keep alive time, if you have any dozens of connection at the same time, how long will this time setting appropriate?
This time is free time? Set up in 100 seconds, for example, the 100 seconds, there are many times communication, send a heartbeat, started 100 seconds after the last free again hair, or ignore this 100 seconds to see if there is communication, every 100 seconds to send a heartbeat?

CodePudding user response:

Length of time to see his needs, if is not very important, can lengthen appropriately, because also consumes traffic keep alive, should be the appearance of a few dozen bytes,

Keep calculation should be the last time to send and receive time, start time, the timeout is the internal keep alive, keep the heart, if there is no communication, still will timeout kept keep alive, the heart beat,

CodePudding user response:

Actually don't have to struggle this bartender how long live often right
The need to maintain a long connection, make the client sends a heartbeat packets on a regular basis to the server is solved,
  • Related