Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 74116 invoked from network); 25 Oct 2004 12:44:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Oct 2004 12:44:44 -0000 Received: (qmail 9530 invoked by uid 500); 25 Oct 2004 12:44:26 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 9432 invoked by uid 500); 25 Oct 2004 12:44:25 -0000 Mailing-List: contact httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "HttpClient Project" Reply-To: "HttpClient Project" Delivered-To: mailing list httpclient-dev@jakarta.apache.org Received: (qmail 9330 invoked by uid 99); 25 Oct 2004 12:44:24 -0000 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=RCVD_ILLEGAL_IP X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from [213.140.2.42] (HELO ms003msg.fastwebnet.it) (213.140.2.42) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 25 Oct 2004 05:44:24 -0700 Received: from pc014 (1.127.172.130) by ms003msg.fastwebnet.it (7.0.028) id 415986AE00D20DF6 for httpclient-dev@jakarta.apache.org; Mon, 25 Oct 2004 14:44:16 +0200 Message-ID: <415986AE00D20DF6@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) From: "Massimo Signori" To: "'HttpClient Project'" Subject: R: still got problems with too TCP connections open Date: Mon, 25 Oct 2004 14:46:50 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcS6iRila/HAFAOfQqORi1wHVl+fRAAB2+sQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <1098705594.2728.3.camel@localhost.localdomain> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N My application is running on winXP with SP2, jre version 1.4.2_05 and connection manager is default. Massimo -----Messaggio originale----- Da: Oleg Kalnichevski [mailto:oleg.kalnichevski@bearingpoint.com]=20 Inviato: luned=EC 25 ottobre 2004 14.00 A: HttpClient Project Oggetto: Re: still got problems with too TCP connections open Massimo, What platform is your application running on? What is the JRE version? What connection manager is being used: default (simple), multithreaded or a custom one? Oleg On Mon, 2004-10-25 at 13:49, Massimo Signori wrote: > Hello, i'm still having a lot of problems with my code and with TCP > connections; at this point I just don't know if the problem is = HttpClient > but I really don't know how to fix this problem... >=20 > here's what my code do:=20 > Method downloadFileViaHttpClient downloads a ZIP file from a server = while > method notifyTimeServer notifies elapsed time to the server every 5 seconds. >=20 >=20 > Now, here's the code: >=20 > HttpClient is instantiated ONE time in both cases. >=20 > private void downloadFileViaHttpClient(String remoteFile, String = savePath) > throws DownloadException { > =20 > =20 > try { > logger.debug("DOWNLOADING FILE... " + remoteFile); > =20 > method =3D new GetMethod(remoteFile); > =20 > =20 > =20 > statusCode=3Dclient.executeMethod(method); > =20 > FileOutputStream out =3D new = FileOutputStream(savePath); > =20 > InputStream in =3D method.getResponseBodyAsStream(); > =20 > byte[] buffer =3D new byte[4096]; > int len =3D 0; > while ((len =3D in.read(buffer)) > 0) { > out.write(buffer, 0, len); > } > =20 > in.close(); > out.close(); > =20 > =20 > } > catch (Exception e) { > method.releaseConnection(); > throw new > DownloadException(DownloadException.DOWNLOADING_ERROR); > } > finally{ > method.releaseConnection(); > } > } >=20 > And the other's method code: >=20 > private void notifyTimeServer() { > =20 > logger.debug("notifyTimeServer, " + timerURL); > =20 > HttpMethod method =3D new GetMethod(timerURL); > =20 > =20 > logger.debug("Establishing connection"); > =20 > try { > statusCode =3D client.executeMethod(method); > =20 > if (statusCode !=3D -1) { > =20 > logger.debug("Connection estabilished"); > byte[] responseBody =3D method.getResponseBody(); > =20 > } > } > =20 > catch (Exception e) { > logger.error("Error calling jsp " + e.getMessage()); > // > } > finally{ > method.releaseConnection(); > } > =20 > } >=20 > NotifyTimeServer is called every 5 seconds... I call = releaseConnection... > but...=20 >=20 > Looking with TCPView the number of connections open... about 5000 !!!! >=20 > Thanks to all for any help >=20 > Best regards,=20 >=20 > Massimo >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: = httpclient-dev-help@jakarta.apache.org *************************************************************************= *** *********************** The information in this email is confidential and may be legally = privileged. Access to this email by anyone other than the intended addressee is unauthorized. If you are not the intended recipient of this message, = any review, disclosure, copying, distribution, retention, or any action = taken or omitted to be taken in reliance on it is prohibited and may be unlawful. = If you are not the intended recipient, please reply to or forward a copy of this message to the sender and delete the message, any attachments, and = any copies thereof from your system. *************************************************************************= *** *********************** --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org