Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 95786 invoked from network); 12 Aug 2004 12:13:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 12 Aug 2004 12:13:40 -0000 Received: (qmail 21192 invoked by uid 500); 12 Aug 2004 12:13:30 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 21174 invoked by uid 500); 12 Aug 2004 12:13:30 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 21158 invoked by uid 99); 12 Aug 2004 12:13:29 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.142.33.20] (HELO mxout6.cac.washington.edu) (140.142.33.20) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 12 Aug 2004 05:13:27 -0700 Received: from smtp.washington.edu (smtp.washington.edu [140.142.33.9]) by mxout6.cac.washington.edu (8.13.0+UW04.06/8.13.0+UW04.06) with ESMTP id i7CCDPJW027543 for ; Thu, 12 Aug 2004 05:13:26 -0700 Received: from [10.0.1.2] (pool-129-44-188-198.bos.east.verizon.net [129.44.188.198]) (authenticated bits=0) by smtp.washington.edu (8.13.0+UW04.06/8.13.0+UW04.06) with ESMTP id i7CCDNrt008185 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 12 Aug 2004 05:13:25 -0700 Mime-Version: 1.0 (Apple Message framework v619) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <00797985-EC59-11D8-A776-00306557E112@u.washington.edu> Content-Transfer-Encoding: 7bit From: Michael Becke Subject: Re: HttpClient ConnectException: Connection refused: connect Date: Thu, 12 Aug 2004 08:13:21 -0400 To: "Jakarta Commons Users List" X-Mailer: Apple Mail (2.619) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi TJ, The various timeouts are, as they sound, timeouts for specific operations. For example when connecting to a server (HttpClient.setConnectionTimeout()) it is the time HttpClient will wait until the connection is established (the socket is opened). In the case you are seeing the problem is not timeout, it's that the server specifically rejects the connection. It may very well be that the server under high load rejects connections. The only recourse in this case is to retry the method. HttpClient.setTimeout() sets the socket SO_TIMEOUT. This is the timeout for an individual read() operation on a socket. Please see the java.net.Socket docs for a little more detail on this. Mike On Aug 11, 2004, at 11:14 PM, T.J. Hoo wrote: > Hi Mike, > > The URL is correct. The GetMethod is executed within a for loop, and > this exception occured only in some loops... > > Well, maybe it is the server that cannot cope up the speed, and > delaying the loop might help in this case. > > Anyway, what is the HttpClient.setTimeout() really means? Why it is > not applicable in this case where the server could be down/slow in > returning the response? > > >> From: Michael Becke >> Reply-To: "Jakarta Commons Users List" >> >> To: "Jakarta Commons Users List" >> Subject: Re: HttpClient ConnectException: Connection refused: connect >> Date: Wed, 11 Aug 2004 22:59:22 -0400 >> >> Hi TJ, >> >> The host/port you are connecting to appears to not be listening. >> Please double check the URL you're connecting to and give it a try in >> a browser to make sure it's actually there. >> >> Mike >> >> On Aug 11, 2004, at 10:41 PM, T.J. Hoo wrote: >> >>> I encounter ConnectException: Connection refused: connect >>> eventhough I set the timeout to 0 (infinite timeout?), what could be >>> the problem? >>> >>> My program: >>> >>> MultiThreadedHttpConnectionManager connManager = new >>> MultiThreadedHttpConnectionManager(); >>> client = new HttpClient(connManager); >>> client.setTimeout(0); >>> >>> the exception: >>> >>> java.net.ConnectException: Connection refused: connect >>> at java.net.PlainSocketImpl.socketConnect(Native Method) >>> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305) >>> at >>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171) >>> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158) >>> at java.net.Socket.connect(Socket.java:452) >>> at java.net.Socket.connect(Socket.java:402) >>> at java.net.Socket.(Socket.java:309) >>> at java.net.Socket.(Socket.java:124) >>> at >>> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.c >>> re ateSocket(DefaultProtocolSocketFactory.java:86) >>> at >>> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java >>> : 651) >>> at >>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$Http >>> Co >>> nnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1170) >>> at >>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav >>> a: 628) >>> at >>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav >>> a: 497) >>> >>> _________________________________________________________________ >>> Download the latest MSN Messenger http://messenger.msn.com.my >>> >>> >>> --------------------------------------------------------------------- >>> 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 >> > > _________________________________________________________________ > Are you in love? Find a date on MSN Personals http://match.msn.com.my/ > > > --------------------------------------------------------------------- > 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