System.net functions are not working

Hi All,

I am trying to troubleshoot a script on a tag that uses the system.net functions. Essentially, we are trying to store some gateway information in some custom tags, which are later on used on some more elaborate navigation scripting across all ignition gateways in our campus.

We created a tag that stores the gateway IP address and hostname among other info, and we have a script that uses the system.net.getIpAddress() and system.net.getHostName() functions to pull this data into the tag, but the data being returned from both functions is null.

I even tried creating individual tags that run nothing but these system scripts, but I am still only receiving null data into those tags. Has anyone run into a similar issue?

We are running perspective on ignition 8.1.35.

Thanks in advance.

Where is the script running? you need to make sure that you are running in gateway.

I was able to get both commands to successfully return the hostname and IP by creating a gateway event message handler with this script

def handleMessage(payload):
	return (system.net.getHostName(), system.net.getIpAddress())

and then called it with system.util.sendRequest(). system.util.sendRequest | Ignition User Manual