How to detect a winsock connection lost
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
I'm using the winsock API in my VC++ 2008 app. When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem. In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR. Does anyone know how to check if the connection is down?
-
I'm using the winsock API in my VC++ 2008 app. When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem. In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR. Does anyone know how to check if the connection is down?