Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 77482 invoked from network); 8 Nov 2006 21:52:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2006 21:52:40 -0000 Received: (qmail 77120 invoked by uid 500); 8 Nov 2006 21:52:50 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 77108 invoked by uid 500); 8 Nov 2006 21:52:50 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 77097 invoked by uid 99); 8 Nov 2006 21:52:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Nov 2006 13:52:49 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [207.97.245.111] (HELO smtp111.iad.emailsrvr.com) (207.97.245.111) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Nov 2006 13:52:35 -0800 Received: from [192.168.0.111] (bas1-stcatharines10-1096572320.dsl.bell.ca [65.92.93.160]) (Authenticated sender: graeme@arizonabay.com) by relay1.r1.iad.emailsrvr.com (SMTP Server) with ESMTP id E973E44CF92 for ; Wed, 8 Nov 2006 16:52:13 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20061108095922.0a5dc9ac@zaphod> References: <312A25A0-EF63-402B-BFEA-A2C280097EFE@arizonabay.com> <20061108095922.0a5dc9ac@zaphod> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Graeme Rouse Subject: Re: Recovering a connection from an unresponsive host Date: Wed, 8 Nov 2006 16:52:12 -0500 To: HttpClient User Discussion X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: OK X-Virus-Checked: Checked by ClamAV on apache.org Olaf, Thank you for the tip. Making this change simplifies my code and best of all, makes it work as I expect. Thanks again for helping me out with this, Graeme On 8-Nov-06, at 3:59 AM, Olaf Sebelin wrote: > Hello Graeme, > > > Graeme Rouse schrieb am 07.11.2006 um 15:33: > > [...] >> >> I have been trying to determine how to correctly set the timeout >> parameters in order to limit the connection time and force the code >> below to complete within a maximum amount of time. > [...] >> >> my code: >> >> final int SOCKET_TIMEOUT = 1000; >> final int CONNECTION_TIMEOUT = 1000; >> long start = System.currentTimeMillis(); >> >> HttpClient httpclient = new HttpClient(); >> GetMethod httpget = new GetMethod( UNREACHABLE_HOST ); >> httpget.getParams().setSoTimeout( SOCKET_TIMEOUT ); >> httpget.getParams().setParameter( "http.connection.timeout", >> CONNECTION_TIMEOUT ); > > Try to set the timeout on the connection manager: > > httpclient.getHttpConnectionManager().getParams() > .setSoTimeout(CONNECTION_TIMEOUT); > > or > > MultiThreadedHttpConnectionManager connectionManager > = new MultiThreadedHttpConnectionManager(); > > connectionManager.getParams().setConnectionTimeout > (CONNECTION_TIMEOUT); > > HttpClient httpclient = new HttpClient(connectionManager); > > > Regards, > Olaf > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: httpclient-user- > help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org