In a c++ application (which I didn’t write) It uses network connection.
in a loop it is always check if the connection is still available.
if I’m taking out the LAN cable, my application just fails because a timeout occured.
Is I know the socket number and connection info. is there any way to know that It is a network error?
In a c++ application (which I didn’t write) It uses network connection. in a
Share
Unplugging the cable is not necessarily a “network error” per se. A TCP connection can easily survive across the disconnection if it’s temporary enough not to reach the timeout set on the TCP connection, which is done on the socket in your case. So you can set the timeout lower, or have some other logic that tests the state of the underlying link (physical interface), but this is rarely done in practice, and usually the TCP timeout is good enough for most purposes. Why is it not good enough for yours?