| Author |
Java Timer
|
Sanjit Singh
Greenhorn
Joined: Nov 12, 2001
Posts: 27
|
|
Hi Everyone, I have a JAVA client that sometimes hangs up waiting for a response from the server. The basic code where it hangs is as follows: ******** BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); ******** where con is an object of the HttpURLConnection class. I would like to avoid this somehow. I would like the thread to only wait for 10 seconds on this particular line (only on this line) and if a response still doesn�t come, then exception occurs. I can imagine that I have to use the Timer class. Any help in this regard (sample code, ideas) would be highly appreciated. Thanks!
|
 |
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
|
Conversation on Timer threads. There are lots of these conversations in the Threads forum.
|
"JavaRanch, where the deer and the Certified play" - David O'Meara
|
 |
 |
|
|
subject: Java Timer
|
|
|