Question

I have multiple network interface(Like WIFI,LAN,LTE dougle).I am sending http request using apache httpclient 4.1.2. I want to select the network interface during sending the http request. I can see the network interfaces using java.net.NetworkInterface class. Can anyone help me how can i do it using http client? I want to send one http request using one network interface and second http request using the other interface. Its like load balancing

Was it helpful?

Solution

You can set the ConnRoutePNames.LOCAL_ADDRESS='http.route.local-address' parameter to the INetAddress of the desired interface. See section 2.4 of this doc for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top