• Post Reply Bookmark Topic Watch Topic
  • New Topic

datagramSocket.receive always giving SocketTimeoutException  RSS feed

 
Muhammad Abubakar Afzal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone tell me why is this happening?
 
Henry Wong
author
Sheriff
Posts: 23292
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Basically, somewhere earlier in your code, you did a setSoTimeout() method call on that datagramSocket. This is done so that reads (ie. receive() calls) do not take forever.

And then, of course, when you call the receive() method, something is wrong. It doesn't get the datagram in the specified timeout, and hence, throws the exception.  Now, as for what the "something" that is wrong is, you will need to debug it -- it could be that the sender is not running (or didn't send it within the timeout), it could be the network, it could be a firewall, router, etc.

Henry
 
Campbell Ritchie
Marshal
Posts: 56223
171
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You would have to give us lots more details before we can help.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!