Programmatically Ping an IP Address From LabVIEW

Updated Aug 21, 2023

Reported In


  • LabVIEW

Issue Details

  • I would like my LabVIEW application to check the connection with an other device on the network by programmatically pinging its IP address.
  • I would like to monitor the VI Server communication between two computers to detect if the communication fails but there is no tool to do this directly, what alternatives do I have?


In real world network-based applications it is important to know if a link is up and running, as well as cable and connector statuses (checking for damage, water intrusion and such...). To obtain such feedback, we can use the built-in Windows OS ping feature. After a successful ping session, you can execute more complicated network tests. The most important step in executing ping commands is to not generate too many requests and to not overload the network, especially if the ping command would be part of automated routing inside a complex application.

Below you can find two different methods to programmatically ping an IP address from LabVIEW.
  • The following example utilize the built-in Windows OS ping feature to perform a ping using LabVIEW. This example uses .NET calls.
  • You can also ping an IP address programmatically by using the System Exec VI to execute the ping <IP address> command. If the device is connected to the network, you will receive a response, otherwise the request will time out. The System Exec VI behaves differently depending on the computer's OS. Refer to Execute Command Line Arguments from LabVIEW for more details.

Additional Information

Using the ping command may be a potential source of memory leaks, since every reply is a new instance. If you perform the ping periodically it is necessary to close these. Also, when you application ends, make sure to close all the .NET references.