LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically check the IP address and Port of a Hardware connected to my PC

Hii guys,

 

I have a communication H/W connected to my PC. Now I manually give the IP address  to establish connection with this  H/W.

Can I poll thr' labview  and find automatically which IP address:Port is connected to my PC.

This comes handy in Test system as if there are 10 systems I dont have to maintain a INI file where I give the IP address and Port number,  instead  automatically determine the same.

 

I can do it for DAQ  devices  or Serial ports. How about   TCP/IP.

regards,

Akshay

0 Kudos
Message 1 of 7
(4,196 Views)

Also my Test system is on the Network. But I  am of the opinion that   windows differentiates between locally connected IP:port  and N/W IPs

0 Kudos
Message 2 of 7
(4,195 Views)

Hi Akshay,

 

you can send TCP/IP requests and check for an answer: when the correct answer is received you have found your hardware.

Or you can PING IP addresses and check the answer on those PINGs…

 

Generic answer: you need to scan your network for correctly configured devices!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(4,179 Views)

hallo Gerd,

 

the  Issue is there will be 10  test systems running. And the IP   has to be found by  the PC automatically.

I just want the my host  pc  to find the IP address of the slave and connect to it asap.

I as a  INI file or text box Input am not in picture.

 

regards

Akshay

0 Kudos
Message 4 of 7
(4,143 Views)

Hi aparab,

 

as I said before: you need to run a small loop to scan the IP address range allowed for your devices!

When the hardware reacts on a PING or TCP/IP request you have found your hardware…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(4,141 Views)

@aparab wrote:

hallo Gerd,

 

the  Issue is there will be 10  test systems running. And the IP   has to be found by  the PC automatically.

I just want the my host  pc  to find the IP address of the slave and connect to it asap.

I as a  INI file or text box Input am not in picture.

 

regards

Akshay


How are the addresss on the test systems set? I am guessing DHCP?

 

How about reserving 10 IP addresses for your test systems that way you know where they are going to be?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(4,126 Views)

There is no generally designed method in the TCP/IP protocol itself that would allow for discovery of arbitrary network devices! In fact there are a myriad of device discovery protocols that all try to solve the problem of letting one find out about possible devices and their addresses on local subnets and even beyond. Many of them are proprietary and badly or not at all documented, like the one NI uses for discovery of their cRIO and other network devices. Most of them and some of the documented ones make use of UDP based broadcasts whith "magically" crafted message headers that a specific device recognizes and then sends a response with its current configuration to the originator of the discovery request.

There are also standards for device discovery such as LLDP (Link Layer Discovery Protocol) which are directly sitting on the IP level of the network protocol layer and therefore only can be implemented with raw sockets, not on top of UDP or TCP. That makes it impossible to create LabVIEW VIs using native LabVIEW network nodes to implement a VI library that would do LLDP. In addition on all modern OSes (Windows 7 and higher, Linux, MacOS X) raw socket access is a privileged feature that can only be done with special privilege escalation (run as administrator on Windows). To be able to run such a protocol from a normal user application level, one would need to install a specific kernel device driver, that handles the raw socket access in the kernel context.

 

As summary: No, there exists no common standard to do device discovery for an arbitrary network device. Depending on the device you have to use a specific method and often that method is proprietary and undocumented, and/or not possible to do with high level protocols sitting on top of UDP (or less likely TCP).

Rolf Kalbermatter
My Blog
Message 7 of 7
(4,076 Views)