What are the pros and cons for implementing your own heartbeat and setting a βfeatβ for a socket?
I read somewhere that keepalive can sometimes fail, and the connection will still be closed (depending on the network structure). Another thing is that your own heartbeat can determine if the application is responding (not just the socket).
My main goal is to provide all this: to keep the connection alive, even though the data is not being sent (apart from the possible beating), quickly detect a loss of connection on both sides, and detect the reaction of the application.
I already implemented a simple heartbeat at both ends, and it works great, however, I wonder if I could replace it with the keepalive function.
source
share