Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Get cRIO IP Address From Hostname

Solved!
Go to solution

We are working on a project where there are multiple cRIOs with the same code that might be plugged into any given computer and stream data via network streams. So we are changing the hostname of the devices to be a unique name and I'm finding the IP address of each device by the hostname. Everything works with the method below but it takes about 15 seconds to query each IP address. Anyone know of a faster way to translate the hostname into an IP address?

 

Get cRIO IP From Hostname.png

0 Kudos
Message 1 of 6
(3,207 Views)
Solution
Accepted by topic author jed255

Another way of going about this is using the command line (system exec) and pinging each device with the -4 flag to get its IP and a text replace to find the IP from the result.

 

oscarfonseca_0-1592349766065.png

 

 

Other option is to have each device publish or register itself into a network server. I have used SystemLink Cloud for this, where my systems will post a tag with their identification information and I will read it using the Skyline API in wither LabVIEW or LabVIEW NXG. I can also see the tag data in a SystemLink cloud Dashboard.

 

Finally, my recommendation is checking out SystemLink, which is dedicated to asset management. You can register all your cRIO devices to a SystemLink server and have all their information and performance handy. You can also use the tags I mentioned before (just pointing to the SystemLink server and not the SystemLink Cloud URL).

 

All the best,

 

 

Message 2 of 6
(3,180 Views)

Awesome, I had tried using ping but didn't include the -4 option so it wasn't working.

 

Thanks for the help Oscar!

0 Kudos
Message 3 of 6
(3,149 Views)
Solution
Accepted by topic author jed255

Use the built in TCP functions.  Very fast, pure G and cross platform.

IP Address Snippet.png

LabVIEW ChampionLabVIEW Channel Wires

Message 4 of 6
(3,140 Views)

That also works and is even faster than using ping.

0 Kudos
Message 5 of 6
(3,116 Views)

Yes, that is pure DNS call and does not actually ping the address and wait for a response.  So it does a bit less but does what is needed and thus is faster.  I assume you detect if the instrument is actually at that address by either attempting to connect or by merely using the TCP Open command with the needed port.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 6 of 6
(3,108 Views)