Hello, Back to this timeout issue. I've added the method below. I modified my copy of HttpClient and HttpConnection, but it looks like it has no effect on the connection timeout.
Furthermore, I have noticed that most of the time the connection does close in the end, and that always happens after about 3 minutes (3' 10-15") of hanging. Why 3 minutes? Where is that specified? Unfortunately, there are some cases where this does not happen, and HTTP Client hangs forever. One such case is this URL: http://64.132.103.224/servlets/Wiki Although, when I telnet to it, port 80, the remote host closes the connection on me, so I don't understand what makes HTTP Client hang. Thanks, Otis On Sat, 01 December 2001, Fredrik Lindgren wrote: > > +1 for adding timeouts > > Currently HttpClient does not seem to have a way to set the timeout. > (I'm just a user and I might be wrong) > > However it should be easy to implement since the HttpConnection uses > Java.net.Socket inside. > > The following snippet should do the trick if added to HttpConnection > > /** > * Set my {@link Socket}'s timeout, via > * {@link Socket#setSoTimeout}. > * @throws SocketException - if there is an error in the underlying > * protocol, such as a TCP error. > * @throws IllegalStateException if I am not connected > */ > public void setSoTimeout(int timeout) > throws SocketException, IllegalStateException { > log.debug("HttpConnection.setSoTimeout()"); > assertOpen(); > _socket.setSoTimeout(int timeout); > } > > > Please correct me if I'm wrong, or respond with a good argument why this > would be a bad way to do it. > > An alternative to changing the public API would be to add a protected > method getSocket() so that extending HttpConnection to support timeouts > would be possible. > > /Fredrik Lindgren > > > [EMAIL PROTECTED] wrote: > > > Hello, > > > > I would imagine that this is a very frequently asked question, but I could not >find any mention of it in the list archives. > > > > Does Commons' httpclient have a way of setting a connection timeout? > > I looked at the API javadocs and could not find a way to do it. > > > > If there is no way to do it does httpclient block when it encounters super slow >connections? > > > > Thanks, > > Otis > > > > _________________________________________________________________ > > iVillage.com: Solutions for Your Life > > Check out the most exciting women's community on the Web > > http://www.ivillage.com > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> _________________________________________________________________ iVillage.com: Solutions for Your Life Check out the most exciting women's community on the Web http://www.ivillage.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>