• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to cope up with problem of Socket Timed Out Exception?  RSS feed

 
Sachindra Pratap
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my application ,i am using udp sockets.
The problem arise,when there is late reply,or no reply from the
udp server,due to which timed out exception comes,as effect of this,
my gui application gets hang,as i have used JOptionPane.showmessageDialog(null,"As the response of udp server"), to show response.

so please anybody tell what could be the problem.

regards Sachindra
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be a network slowdown or server problem for any number of reasons.

I'd suggest as a workaround not to assume that a reply will arrive quickly. Change the GUI so that the user can continue working with the application, even if it is delayed.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you must have a response, UDP is the wrong protocol to use:

UDP does not guarantee reliability or ordering in the way that TCP does. Datagrams may arrive out of order, appear duplicated, or go missing without notice. Avoiding the overhead of checking whether every packet actually arrived makes UDP faster and more efficient, for applications that do not need guaranteed delivery. Time-sensitive applications often use UDP because dropped packets are preferable to delayed packets.

Wiki on UDP
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!