For Programmers: Free Programming Magazines  


Home > Archive > Java Help > September 2006 > Help on Socket and URLConnection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help on Socket and URLConnection
Mudit Khetan

2006-09-27, 4:05 am

Hi all,
I am trying to make some tutorial assignmemnts and example programs for
my classes. I'm trying to use the 'Socket' and 'URLConnection' classes.
I am wondering if I can set a timeOut and catch the exception when the
connection times out. I'am implementing a simple webserver for which i
need this facility.
Thanks

hiwa

2006-09-27, 4:05 am

Mudit Khetan wrote:
> Hi all,
> I am trying to make some tutorial assignmemnts and example programs for
> my classes. I'm trying to use the 'Socket' and 'URLConnection' classes.
> I am wondering if I can set a timeOut and catch the exception when the
> connection times out. I'am implementing a simple webserver for which i
> need this facility.
> Thanks

Generally or usually, if you use URLConnection, a higer level of remote
connection abstraction than Socket, you won't need Socket for your
application. URLConnection class has setReadTimeout() method for which
read operation would throw java.net.SocketTimeoutException when the
timeout expired.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com