DatagramSocket.receive waits forever (despite 3 second SoTimeout)!

I

Imran

Hi All,

Thanks in advance for your help. I am curious if anyone has ever
encountered a situation where a receive call on a UDP client socket
waits for ever, despite having a soTimeout of 3 seconds.

The application contains many sender threads which each create a
socket, send a request and wait for a response. Mostly these threads
send and receive as expected, but over time they wait indefinitely on
DatagramSocket.receive for a response, eventually exhausting the entire
thread pool.

Sending a random packet to the client port of these blocking sockets
wakes them up and they continue to process as expected.

Just curious if anybody has encountered this behavior in their
applications!

Thx,

Imran
 
R

Roedy Green

soTimeout of 3 seconds.

You showed no code so all I can do is speculate:

1. You mean 3000 milliseconds. setSoTimeout wants a value in ms.

2. did you set the timeout prior to the read?

3. did you set the timeout on the right DatagramSocket.

4. did you set up to catch the SocketException and do something other
than throw it away or immediately start another read.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top