Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 36254 invoked from network); 25 Oct 2004 11:47:12 -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:47:12 -0000 Received: (qmail 18840 invoked by uid 500); 25 Oct 2004 11:47:07 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 18806 invoked by uid 500); 25 Oct 2004 11:47:06 -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 18788 invoked by uid 500); 25 Oct 2004 11:47:06 -0000 Received: (qmail 18784 invoked by uid 99); 25 Oct 2004 11:47:06 -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 04:47:05 -0700 Received: from pc014 (1.127.172.130) by ms003msg.fastwebnet.it (7.0.028) id 415986AE00D190BF for commons-httpclient-dev@jakarta.apache.org; Mon, 25 Oct 2004 13:47:02 +0200 Message-ID: <415986AE00D190BF@ms003msg.mail.fw> (added by postmaster@fastwebnet.it) From: "Massimo Signori" To: Subject: still got problems with too TCP connections open Date: Mon, 25 Oct 2004 13:49:39 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcS6iLUrRr4yRBCpSAqpmJAvuFFvuQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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