This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Timeout

Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,
Can anyone tell me how to set timeout for java.net.HttpURLConnection?

Amit


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

Please don't post the same question in multiple forums. We all read several forums so you are not increasing your audience. You also may be wasting the communities time as we answer the same thing in multiple places.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Fahd Shariff
Ranch Hand

Joined: Nov 22, 2002
Posts: 38
If you are using J2SE 5.0 then you can call the method setConnectTimeout. Otherwise you will have to start a new Thread which keeps track of how much time has elapsed since you tried to open the connection.


Fahd Shariff<br />"Let the code do the talking"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Timeout
 
Similar Threads
MQ: MQException: Completion Code 2, Reason 2033
Ability to timeout a servlet executing for too long
this JSP may help many people?
Tomcat saves the sessions even if I stop application!!!
image insertion problem