IOCP Socket Timeout Problem..
-
We have developed one IOCP server Application. We got a socket close event when client application (safe/unsafe) close. But when client machine restarts or network cable unplugged we can not get any event of the socket close. We have also tried to set socket timeout with setsockopt() ,but its not working with IOCP. So ,Is there any method to get close event for this sockets? or any other method to set timeout in IOCP. Thank you.
-
We have developed one IOCP server Application. We got a socket close event when client application (safe/unsafe) close. But when client machine restarts or network cable unplugged we can not get any event of the socket close. We have also tried to set socket timeout with setsockopt() ,but its not working with IOCP. So ,Is there any method to get close event for this sockets? or any other method to set timeout in IOCP. Thank you.
What is an "IOCP server Application"? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
We have developed one IOCP server Application. We got a socket close event when client application (safe/unsafe) close. But when client machine restarts or network cable unplugged we can not get any event of the socket close. We have also tried to set socket timeout with setsockopt() ,but its not working with IOCP. So ,Is there any method to get close event for this sockets? or any other method to set timeout in IOCP. Thank you.
No, IP is not a 'connected' protocol, it just maintains connection state on each side. This is usually considered a feature as it allows recovery from temporary disconnects. A common solution is to add a heart-beat message to your protocol that the server sends to the client. The heart-beat message basically says 'hey, are your still there? if so please respond to this'. If the client doesn't respond in a timely manner it is assumed that the connection is broken. See: http://tangentsoft.net/wskfaq/newbie.html#abnormalclose[^]
...cmk The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying. - John Carmack