Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 42121 invoked from network); 25 Oct 2004 11:59:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Oct 2004 11:59:02 -0000 Received: (qmail 33908 invoked by uid 500); 25 Oct 2004 11:58:59 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 33858 invoked by uid 500); 25 Oct 2004 11:58:59 -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 33844 invoked by uid 99); 25 Oct 2004 11:58:59 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [57.80.136.23] (HELO kccxoex15.corp.kpmgconsulting.com) (57.80.136.23) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 25 Oct 2004 04:58:58 -0700 Received: from kccxoex06.corp.kpmgconsulting.com ([10.98.3.31]) by kccxoex15.corp.kpmgconsulting.com with InterScan Messaging Security Suite; Mon, 25 Oct 2004 11:58:51 -0000 Received: KCCXOEX06 10.98.3.31 from 10.131.13.183 10.131.13.183 via HTTP with MS-WebStorage 6.0.6249 Received: from localhost.localdomain by KCCXOEX06; 25 Oct 2004 13:59:54 +0200 Subject: Re: still got problems with too TCP connections open From: Oleg Kalnichevski To: HttpClient Project In-Reply-To: <415986AE00D190BF@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) References: <415986AE00D190BF@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1098705594.2728.3.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 25 Oct 2004 13:59:54 +0200 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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... > > here's what my code do: > Method downloadFileViaHttpClient downloads a ZIP file from a server while > method notifyTimeServer notifies elapsed time to the server every 5 seconds. > > > Now, here's the code: > > HttpClient is instantiated ONE time in both cases. > > private void downloadFileViaHttpClient(String remoteFile, String savePath) > throws DownloadException { > > > try { > logger.debug("DOWNLOADING FILE... " + remoteFile); > > method = new GetMethod(remoteFile); > > > > statusCode=client.executeMethod(method); > > FileOutputStream out = new FileOutputStream(savePath); > > InputStream in = method.getResponseBodyAsStream(); > > byte[] buffer = new byte[4096]; > int len = 0; > while ((len = in.read(buffer)) > 0) { > out.write(buffer, 0, len); > } > > in.close(); > out.close(); > > > } > catch (Exception e) { > method.releaseConnection(); > throw new > DownloadException(DownloadException.DOWNLOADING_ERROR); > } > finally{ > method.releaseConnection(); > } > } > > And the other's method code: > > private void notifyTimeServer() { > > logger.debug("notifyTimeServer, " + timerURL); > > HttpMethod method = new GetMethod(timerURL); > > > logger.debug("Establishing connection"); > > try { > statusCode = client.executeMethod(method); > > if (statusCode != -1) { > > logger.debug("Connection estabilished"); > byte[] responseBody = method.getResponseBody(); > > } > } > > catch (Exception e) { > logger.error("Error calling jsp " + e.getMessage()); > // > } > finally{ > method.releaseConnection(); > } > > } > > NotifyTimeServer is called every 5 seconds... I call releaseConnection... > but... > > Looking with TCPView the number of connections open... about 5000 !!!! > > Thanks to all for any help > > Best regards, > > Massimo > > > --------------------------------------------------------------------- > 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