Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 7139 invoked from network); 7 Dec 2004 17:46:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Dec 2004 17:46:20 -0000 Received: (qmail 25858 invoked by uid 500); 7 Dec 2004 17:45:33 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 25734 invoked by uid 500); 7 Dec 2004 17:45:31 -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 25637 invoked by uid 99); 7 Dec 2004 17:45:29 -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 chiquita.toad.net (HELO chiquita.toad.net) (66.159.80.189) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 07 Dec 2004 09:45:25 -0800 Received: by chiquita.toad.net (Postfix, from userid 48) id A62CA916AA; Tue, 7 Dec 2004 12:45:28 -0500 (EST) Received: from pool-68-160-187-27.bos.east.verizon.net (pool-68-160-187-27.bos.east.verizon.net [68.160.187.27]) by webmail.toadmail.com (IMP) with HTTP for ; Tue, 7 Dec 2004 12:45:28 -0500 Message-ID: <1102441528.41b5ec3852f92@webmail.toadmail.com> Date: Tue, 7 Dec 2004 12:45:28 -0500 From: Eric Renouf To: Jakarta Commons Users List Subject: Re: httpclient local address trouble References: <1102380226.41b4fcc295db8@webmail.toadmail.com> <8A114460-4801-11D9-AAAA-00306557E112@u.washington.edu> In-Reply-To: <8A114460-4801-11D9-AAAA-00306557E112@u.washington.edu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="-MOQ1102441528026fa192534196f1e976ff23f8ed1fbf" User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ---MOQ1102441528026fa192534196f1e976ff23f8ed1fbf Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Ok, thanks for taking the time to look. Here's a few pieces of my code: This is from the constructor for the class: hostConf = new HostConfiguration(); hostConf.setHost(cur); if(ip != null) { try { hostConf.setLocalAddress(InetAddress.getByName(ip)); } catch(Exception e) { System.err.println("Couldn't get that address: " + e.getMessage()); } } MultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams p = manager.getParams(); p.setDefaultMaxConnectionsPerHost(100); // TODO Should be configurable from file p.setMaxTotalConnections(100); // TOOD Should be configurable from file p.setConnectionTimeout(5000); // TODO should be configurable from file manager.setParams(p); manager.closeIdleConnections(5000); // TODO should be configurable from file browser = new HttpClient(manager); browser.setHostConfiguration(hostConf); And this is where I try to actually do the request: GetMethod m = new GetMethod(); try { m.setPath(cur.getPath()); try { browser.executeMethod(hostConf, m); if(m.getStatusCode() != 200) { warn("Got Status code " + String.valueOf(m.getStatusCode()) + " for " + cur); throw new NoPageException(); } host = hostConf.getHostURL(); links = getLinks(m); } catch(HttpException hEx) { System.out.println("Http Exception: " + hEx.getMessage()); } catch(IOException ioEx) { System.out.println("IOException while browsing: " + ioEx.getMessage()); } finally { m.releaseConnection(); } I'm attaching the wire log, or at least the first few hundred lines from it. If I trimmed something you need to see let me know. Thanks for your time and help. Eric Quoting Michael Becke : > Hi Eric, > > I can't think of anything at the moment that would cause this. If you > post a sample of the code you are using and a wire log showing the > problem we should be able to track down the problem. > > > > Mike > > On Dec 6, 2004, at 7:43 PM, Eric Renouf wrote: > > > Hi, > > > > I'm trying to setup an application that will run a bunch of > > HttpClient's from > > the same machine, simulating a bunch of different "real" users. One > > thing that > > would make the more real is to have them coming from different IP > > addresses, > > which are all aliased on the machine already. I tried creating an > > HostConfiguration object and calling > > hostConf.setLocalAddress(InetAddress.getByName(ip)); for each IP. > > Sometimes > > this seems to work, but sometimes not. When I watch the Apache logs > > I'll > > sometimes see the IPs that I'm trying to use but more often than not I > > see the > > default address for the host. The line above does not raise an > > exception, and > > if I call hostConf.getLocalAddress later it gives me the IP back (with > > a / in > > front of it). > > > > I try both calling the setHostConfiguration on the HttpClient object > > and also > > passing it in when I call executeMethod (GetMethod only being used). > > I'm using > > the commons-httpclient-3.0-beta1 package. > > > > Can someone help point me in the direction for what I can do to figure > > out what > > I'm doing wrong here? I've tried googling "httpclient local address" > > and tried > > similar searches through the mailing list archives but haven't found > > anything > > too promising yet. Any help would be very much appreciated. > > > > Eric > > ___________________________________________________________ > > This mail sent using ToadMail -- Web based e-mail @ ToadNet > > > > --------------------------------------------------------------------- > > 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 > ___________________________________________________________ This mail sent using ToadMail -- Web based e-mail @ ToadNet ---MOQ1102441528026fa192534196f1e976ff23f8ed1fbf Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org ---MOQ1102441528026fa192534196f1e976ff23f8ed1fbf--