Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.net.ConnectException: Connection timed out: connect

 
Ulvi Cetin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting java.net.ConnectException: Connection timed out: connect on an HttpURLConnection. Is this caused by a slow internet connection? Is there a way to set the timeout to a longer time?

Thx.
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could be caused by mispelled URL or unreachable destination host. Could you post your code?
 
Ulvi Cetin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code executes 9 out of 10 times, but once in a while, I get this connection timeout exception. I am guessing it is caused by slow internet traffic, but not sure.
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hasn't this ever happened to you within a web browser? When you catch it, retry the connection. Problem solved.
 
Ulvi Cetin
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but this in an unattended software which runs in the middle of the nite. If this happens, there is no way I will notice it restart the program.
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So? Why is that a problem? If it times out, try again and log it.
[ July 15, 2004: Message edited by: Darin Niard ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic