Example Code

Ping Network Device in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview:

This VI will ping a network device and return a boolean signal for its connection status.

 

Description:

This VI pings an IP address using System Exec.vi. The connection status returned depends on whether the Command Prompt returns a value of "Request timed out." You can select the number of attempts to ping and the amount of wait time.

 

Note: This VI has only been tested on Windows PCs, not confirmed to work on other devices or operating systems

 

Requirements:

LabVIEW 2012 (or compatible)

 

Steps to implement or Execute Code:

1. On the front panel, input the IP address, number of attempts to ping, and the waiting time.
2. Run the VI.
The applications will try to ping the network device and return the connection status.

 

Additional Information or References:

 Block Diagram of the VI:

 ping_snippet.png

" -n " is the command prompt code for inputting the number of ping attempts

" -w " is the command prompt code for amount of ms to wait.

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Regards,

Mike S
NI AE

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.