Associating a JVM with a non-standard IP address

I have a multihomed system with multiple network adapters and IP addresses.

I'm not sure if my Sun JVM selects an IP representing the 'this' system (that is the β€œ source of IP ” when connecting to another system using Socket or URLConnection). Does the system network adapter choose the default, or perhaps reverse search by system name? and etc.

In any case, is there a way to explicitly bind the JVM to a specific IP?

Alternatively, if someone knows how to do this from within Axis Webservices, this would be very helpful.

Very much appreciated ..

0
source share
2 answers

Run by the operating system, not the JVM. It uses the routing table to determine which interface can route to the destination you are trying to reach and use it.

If you have several interfaces that can be routed to a given destination, theoretically you should be able to choose which source address to use, but I don’t know if you really can - maybe bind before the connection will do? But then, since you will not have access to the routing table, how do you decide which interfaces can reach the destination?

+4
source

I'm not sure how to manage it when using a URL , but when creating a Socket you can use a constructor that takes a local address argument.

+2
source

Source: https://habr.com/ru/post/1342868/


All Articles