Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Binding Jetty HttpClient to Network Interface Card

Use .setBindAddress(SocketAddress)
Use the IP address of your NIC.
Set the port to the ephemeral port 0

Answered on stackoverflow too.
http://stackoverflow.com/questions/39778516/binding-jetty-httpclient-to-network-interface-card

Joakim Erdfelt / joakim@xxxxxxxxxxx

On Thu, Sep 29, 2016 at 1:47 PM, Lothar Kimmeringer <job@xxxxxxxxxxxxxx> wrote:
Hi,

Am 29.09.2016 um 22:36 schrieb davidjesse091@xxxxxxx:
The setBindAddress method takes in an ipaddress or hostname and a port
 number, I don't understand what the port number is for.

To specify where the client should listen for incoming requests.

 I used the binding functionality of Apache HttpComponents and I
 had to provide it with a InetAddress. But I am straggling to find
 a way to make it work for Jetty

Find a free port and use it for calling that method, e.g.

ServerSocket ss = new ServerSocket(0, 1, getByName("192.168.1.1"));
SocketAddress sa = ss.getLocalSocketAddress();
ss.close();
jettyClient.setBindAddress(sa);

Since I don't use that kind of functionality (I'm developing on
the server side), this is just an educated guess.


Cheers, Lothar

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top