Im implementing my own proto in Java, it will use a heartbeat over the TCP connection, which I also use to send messages and files. For the client, I use I / O lock. So, this is how I plan it to work ... I will set the socket timeout to K seconds and make a hearty reception sending messages in the interval T, so T <K. If the timeout expires, it looks like the server disabled for client or vice versa.
The heart is the server sending the line and the client, responding to another.
I do not want to spend a lot of traffic, but with a large timeout, the server may be mistaken in the status of the client.
What is a good K interval? I think about 40 seconds
PS: strings have 8 letters sent to ISO-8859-1, so its little data
source
share