I have a Socket Client and need detect when my socket server (an Equipment) was disconnected.
But I don't wanna send characters to discovery this.
What I Would to use ? KeepAlive ? SendTimeout SocketOptionLevel ?
And how to make it....
I have a Socket Client and need detect when my socket server (an Equipment) was disconnected.
But I don't wanna send characters to discovery this.
What I Would to use ? KeepAlive ? SendTimeout SocketOptionLevel ?
And how to make it....
I believe receicve will return 0 for a graceful disconnect, and < 0 for un normal disconnects. Either that or the socket will throw an exception when you try reading from something not connected.
If you're using TCP, then Valaris is correct, remember the the recieve call is a loop that will keep reading whilst the condition you set it still exists or for the reasons Valaris said.
A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside