commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück <>
Subject Re: [httpclient]-timeout-> i found a small but important bug.
Date Fri, 08 Nov 2002 09:57:57 GMT

You misunderstood the meaning of the setTimeout() method. This sets the 
SO_TIMEOUT property of a socket, which is the maximum time that must 
pass between data packets sent through this socket. If no traffic occurs 
on the socket for this duration the socket automatically disconnects.

This is very different from a connection timeout (as in your code).

Unfortunately connection timeouts are a feature of JDK 1.4 and are not 
backwards compatible to 1.3. So we can not use this feature at the moment.

There is already a feature request for this in Bugzilla:
scheduled for the 2.0 release.

I feel that this is a major requirement and I can try and post a 
solution shortly.

Thanks for trying to contribute. However you are strongly encouraged to 
use CVS / diff to submit patches. Posting whole files without a diff is 
not feasible because we can not easily spot the changes. More coding 
rules can be found here:

Kind regards to Israel


p.s. Please post HttpClient issues directly to and *not* to the commons list, 
as your email may easily missed by the committers (depending on how good 
our filters are...). You can ommit the [HttpClient] prefix then. Patches 
should have the [PATCH] prefix in the subject line.

Noam Berg wrote:

> Hello,
> I need to use http connections with timeouts, since it is not part of the
> release i downloaded 7th Nov 2002 sources, but
> using HttpClient.setTimeout didnt help. i checked out the code and 
> find out
> that when you create the sockets using host+port
> it immediately connects so setting the timeout after that does not change
> (at least in my case where i dont reuse them
> and its important in first connect for a timeout to be set).
> The changes:
> line 350:
> 	 _socket = new Socket();
> 	_socket.connect(new
> line 781:
> 	Socket s = sslSocketFactory.createSocket();
> 	s.connect(new, port), _so_timeout);
>             return s;
> and the whole file :
>  <>
> i'm sorry but i dont have CVS ...
> 10x.
> P.S.
> Another small thing (suggestion) ...
> When i first started using this package i wanted to do a very simple
> httpconnection ...
> what would have help me _a lot_ would have been a few small source 
> examples
> for usage
> (maybe a bit like your test classes).
> 10x
> Noam Berg
> R&D
> SofaWare Technologies Ltd.
> 3 Hahilazon St. Ramat-Gan Israel
> Tel:  +972-3-6128989 ext 102
> Fax: +972-3-5755442
> E-mail:
> Web:
> ------------------------------------------------------------------------
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail: 

  NOSE applied intelligence ag
  ortwin glück                      [email]
  hardturmstrasse 171               [pgp key]          0x81CF3416
  8005 zurich                       [office]      +41-1-277 57 35
  switzerland                       [fax]         +41-1-277 57 12

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message