tags:

views:

22

answers:

1

I am working on a application which sends UDP packet to initiate a Processing and needs to send back response on same socket after 3-5 minutes, but issue is that when response is sent back, it never reaches client. I am using java. Any suggestions, how we can keep the socket alive over longer period of time?

--

A: 

Any suggestions, how we can keep the socket alive over longer period of time?

and

Is there a way to set UDP timeout setting ...?

UDP is connectionless. If an application binds to a UDP server-socket and listens, it can wait for messages to arrive indefinitely.

The flipside is that there is no way to detect a lost UDP message at the protocol / socket level. If one machine sends a UDP message to another one, the first machine has no direct way of knowing if the message has arrived or not? There are no transport level timeouts to tell the sender to retransmit.

If you need reliability, timeouts, automatic retransmission, etc, you are better of using a connection-based transport protocol such as TCP.

Stephen C
Issue as suggested by a colleague, might be that firewall closes UDP connections if there is no activity for certain period of time, for communication to be reliable one need to implement timeout probe.
sachin