LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Obtaining TCP address of network device based off of name given in NI-MAX

I have a network device configured in NI-MAX.  I manually added the network device using "manual entry of raw socket".  I then gave my device a name (i.e. "Device1").  Device1 is shown in NI-MAX as "TCPIP0::192.168.100.10::1234:: SOCKET "Device1""

 

In LabVIEW when I open a TCP connection I don't want to pass it "192.168.100.10" as the IP address directly.  I wanted to know if I can lookup the IP address based off the name "Device1" I gave so the IP address does not get hard coded in my LabVIEW code?

 

Thanks.

0 Kudos
Message 1 of 3
(1,951 Views)

The name you've set in NI-MAX is a VISA connection alias, not a TCP connection.  The direct TCP communications functions can't use it.  The VISA read/write functions can, though.  I have found that using VISA over a raw socket manual entry sends extra control characters that some devices don't parse, so it's not always an option.

 

"Not hardcoding" doesn't always mean "Using NI-MAX", you could also store the connection in an INI file, or look up the hostname instead of the IP (assuming it has a hostname, otherwise you'll have to set it using your hosts file in C:\Windows\System32\drivers\etc).

 

0 Kudos
Message 2 of 3
(1,922 Views)

@Guy04 wrote:

I have a network device configured in NI-MAX.  I manually added the network device using "manual entry of raw socket".  I then gave my device a name (i.e. "Device1").  Device1 is shown in NI-MAX as "TCPIP0::192.168.100.10::1234:: SOCKET "Device1""

 

In LabVIEW when I open a TCP connection I don't want to pass it "192.168.100.10" as the IP address directly.  I wanted to know if I can lookup the IP address based off the name "Device1" I gave so the IP address does not get hard coded in my LabVIEW code?

 

Thanks.


Install NI VISA driver from here http://www.ni.com/download/ni-visa-17.0/6646/en/, after that you'ld have this *?INSTR command in find resource as a input, it'll display all connected devices where you've connected in pc.

0 Kudos
Message 3 of 3
(1,903 Views)