Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    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: 9425
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.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!