Getting Vision Client IP address with multiple Adapters

Trying to set the default screen for a Vision client on startup using the IP address, but even though the PC has two ethernet ports with only one that can connect to the gateway, the client tag for IPAddress and system.net.getIpAddress both are returning the IP address on the port not connected to Ignition.

Any ideas on how to get the other address? Or even both IP addresses?

You can enumerate network adapter and ip with java. Those function return as well virtual adapter

1 Like

Think I've got it figured out. I switched to using getExternalIpAddress instead. Now I get the IP from the gateway POV.

That breaks if there's any NAT between the client and the gateway. Consider this technique:

Note the use of a fake UDP connection (no actual packets sent) to coerce the OS to expose the source interface and IP selected for the route to the Ignition Gateway.

1 Like