Advertisement

Problems with UDP

Started by April 04, 2003 08:20 AM
0 comments, last by Orca_ 21 years, 10 months ago
How can I know if the client has closed down the socket/program if I am using unconnected UDP? (In TCP, recv() returns 0 when this happends, but recvfrom() returning 0 is not the same thing.)
UDP is not a connection based protocol. There is no connection: if you want to detect when a host is down you have to implement the thing by yourself.
A possible solution is to send "keep-alive" packets every x seconds and set a timeout on the receiver machine. If you don''t receive keep-alives for a period of time you can assume that the other machine has "disconnected".

This topic is closed to new replies.

Advertisement