CSocket doesn't receive OnClose or OnReceive when you disable network connection on the client side

StackOverflow https://stackoverflow.com/questions/1908634

  •  19-09-2019
  •  | 
  •  

Question

I've created a client server application with c++ CSocket. when I connect the client to the server and after that I close the client with normal X button or end task it with taskmanager , server CSocket receives the OnClose event. The problem is when I disable the internet connection on windows that the client is running on, server CSocket doesn't receive the OnClose nor OnReceive event!

Is anyone possibly know what's going on?

Update: I've just tested and saw that client didn't recieve the OnClose too! I disabled the internet connection on the windows that the client is running on!

Was it helpful?

Solution

The client side is shutdown without being able to close the connection to the server via a FIN or RST. For the server to detect that the client is dead it must either have data to send (which would fail) or must send periodic TCP keepalive probes. TCP_KEEPALIVE can be set as a socket option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top