getGatewayAddress() in the gateway scope?

The system.util.getGatewayAddress() is only available in the client scope.
I would like to obtain the gatewayAddress in the gateway scope ?

Which one should it return? There’s at least two, counting localhost. Could be many more. From a client, there’s only the one it actually reached, so it is unambiguous. The best you can do is enumerate your local addresses using Java’s NetworkInterface class.

Unless you are a module developer working on RPC – that has access to the client session within gateway scope.

my need is to execute a traits in gateway scope only is the gateway has a particular ip.
A gateway backup can be restored on multiple pc on our network, and I want some traits only execute on the main server.

Then java’s NetworkInterface class is your friend. Loop through your network interfaces checking each one’s list of addresses.

Thanks a lot

An example you can steal from: https://github.com/eclipse/milo/blob/master/opc-ua-sdk/sdk-server/src/main/java/org/eclipse/milo/opcua/sdk/server/util/HostnameUtil.java

:+1: