hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Adams <steve...@gmail.com>
Subject Re: Force httpclient to use an alt IP
Date Thu, 09 Oct 2008 04:08:00 GMT
Ahh..

Thanks Oleg.

Oleg Kalnichevski wrote:
> 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: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message