Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



    Bookmark Topic Watch Topic
  • New Topic

Timeout  RSS feed

 
Amit G Piplani
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
Can anyone tell me how to set timeout for java.net.HttpURLConnection?

Amit
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Fahd Shariff
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!