How to add heartbeat messaging on top of this Java code( for KnockKnockClient/Server)?

But the exception you are getting is exactly this! It’s telling you that the other side just died. Just catch the exception and print to the console, that “The system has detected that KnockKnockServer was aborted”.

You are using TCP connection and TCP has built-in heartbeat (keepalive) mechanism that will do this for you. Just set setKeepAlive() on the socket. That being said – It is possible to control keepalive frequency per each connection, but I do not know how to do that in java.

http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html

https://stackoverflow.com/a/1480259/706650

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)