On Tue, 2008-10-07 at 17:33 +1100, Steven Adams wrote:
> Hi All,
> 
> I have several IP's on the server I'm using HttpClient 4.
> 
> I would like to force httpclient to use one of the other IP's, can 
> someone please tell me if this is possible and how?
> 
> Thanks
> Steve
> 

Set 'http.route.local-address' parameter to the desired local address
either on the client or request level:

---
DefaultHttpClient  httpclient = new DefaultHttpClient(params);

httpclient.getParams().setParameter(
 ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());

HttpGet httpget = new HttpGet("http://localhost:8080";);
httpget.getParams().setParameter(
 ConnRouteParams.LOCAL_ADDRESS, Inet4Address.getLocalHost());

HttpResponse response = httpclient.execute(httpget);
---

Hope this helps

Oleg


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to