commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex <alexn...@optonline.net>
Subject RE: [commons-httpclient] setConnectionTimeout not working?
Date Tue, 25 Apr 2006 15:10:06 GMT
Thanks Oleg,
with what JRE timeout wouldn't  work?
Is there a way I could measure connection time and not a full request time?

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, April 25, 2006 10:57 AM
To: Jakarta Commons Users List
Subject: RE: [commons-httpclient] setConnectionTimeout not working?

On Tue, 2006-04-25 at 10:50 -0400, Alex wrote:
> I am using latest Netbeans 5.0  JRE 1.5..   does it make a difference? 

Yes, it does. 

> What
> JRE would I need to use for the timeout to work?

First of all, you need to understand that the connect timeout is the
maximum period of time a socket can stay blocked until the connection
with the remote host is fully established. This has nothing to do with
the total request execution time, which you are measuring in your code

Hope this helps

Oleg 


> 
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Tuesday, April 25, 2006 3:52 AM
> To: Jakarta Commons Users List
> Subject: Re: [commons-httpclient] setConnectionTimeout not working?
> 
> On Mon, 2006-04-24 at 18:38 -0400, Alex wrote:
> >   client = new HttpClient();
> > 
> >  
> > 
> > SimpleHttpConnectionManager mr = new SimpleHttpConnectionManager();
> > 
> > mr.getParams().setConnectionTimeout(1000);
> > 
> > client = new HttpClient(mr);   
> > 
> >  
> > 
> > 
> > 
> > long startTime = System.currentTimeMillis();
> > 
> > int resultCode = client.executeMethod(getMethod);  
> > 
> > setConnTime(System.currentTimeMillis()-startTime);  
> > 
> >  
> > 
> > 
> > 
> > my connection timeout is set to 1000 (1 second),  output shows that
> > connection to some site took over 3-4 seconds and 
> > 
> > it never comes to "catch (ConnectTimeoutException e)"  
> > 
> >  
> > 
> > 
> > 
> > why is it not throwing ConnectTimeoutException?
> > 
> 
> What's the JRE version that you are using? 
> 
> Try connecting to the host using a plain java.net.Socket and see if it
> times out on connect.
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message