aspose file tools*
The moose likes Java in General and the fly likes java.net.ConnectException: Connection timed out: connect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.net.ConnectException: Connection timed out: connect" Watch "java.net.ConnectException: Connection timed out: connect" New topic
Author

java.net.ConnectException: Connection timed out: connect

Ulvi Cetin
Ranch Hand

Joined: Mar 03, 2003
Posts: 39
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

Joined: Mar 13, 2004
Posts: 356
I could be caused by mispelled URL or unreachable destination host. Could you post your code?
Ulvi Cetin
Ranch Hand

Joined: Mar 03, 2003
Posts: 39
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

Joined: Jun 08, 2004
Posts: 118
Hasn't this ever happened to you within a web browser? When you catch it, retry the connection. Problem solved.
Ulvi Cetin
Ranch Hand

Joined: Mar 03, 2003
Posts: 39
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

Joined: Jun 08, 2004
Posts: 118
So? Why is that a problem? If it times out, try again and log it.
[ July 15, 2004: Message edited by: Darin Niard ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.net.ConnectException: Connection timed out: connect