Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

datagramSocket.receive always giving SocketTimeoutException  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone tell me why is this happening?
 
author
Sheriff
Posts: 23507
138
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
 
Marshal
Posts: 59092
180
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!