I'm making a little program, and I'm trying to handle a Client disconnect. When the client disconnects he sends a shutdown message and I handle that. But when the client gets closed with force (network connection lost, task killed, exception..) The server still sees the client as connected. Now, I'm trying to Immediately update this information, once the client is not connected anymore he should be removed. I can't just ping him every now and then, can I? What if there is a transmission ongoing and I interfer with my ping command?
TL;DRHow do I know if my client is not connected anymore?