How to timeout a URLConnection. Or how to find out it URLConnection.getInputString() will get stuck?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jeba_Shaker
Posted On:   Friday, February 8, 2002 11:35 AM

In one of my functions I am trying to send a request & get a response. In getting the response, sometimes the getInputStream gets stuck:-

URLConnection urlconn = url.openConnection();
...
return urlconnection.getInputStream()

1) Is there a way to find out if it is in a bad state before we execute it. Like if (urlconnection.badState()).
2) Is there a way to set a timeout, so it will try to get the response & timeout after few seconds?
Like urlconnection.setTimeOut=10;
My email jshaker@hotmail.com
Thank You

About | Sitemap | Contact