How to Identify "if a UDP socket did not receive any packet in a certain time interval".
Posted on 2004-11-15
The following line of code exists in my program
where dp is a datagram packet, d is a datagram socket.
Now, my program waits for a packet to arrive and then depending on what arrived the rest of the program depends., but what i want to do is if this socket does not receive any packet for a certain interval of time , say 5seconds, i want to perform some other task. The difficulty is how do i get out of this line of code, when i dont receive any packet for the predefined interval of time ( and understand that it came to the next line because of "not receiving any packet for 5 seconds"). It just simply does not come out of that line until it receives a datagram packet.
Thanks and regards,