How to Detect Network Connection Loss of NI Real-Time Target

Updated May 12, 2022



  • CompactRIO Chassis


  • LabVIEW
  • LabVIEW Real-Time Module

Let's suppose you want to discover a network connection loss on your NI Real Time Target in order to avoid damage to your hardware. 
There are several methods to implement this: continuously pinging the host target, TCP/IP communication or NI cRIO 
 In this article, we will discuss another method of implementing this by means of Network Published Shared Variable. 

First of all, it is necessary to create a Network Published Shared Variable (or refer to this external link: Create a network-published shared variable). It is not important the datatype of the variable. 
 After that add into your Real-Time VI Read Variable with and add the necessary information as the name of the variable, timeout duration, and connect Timed out output of the VI to a Case Structure where you implement some logic (for example setting the output voltage to 0). The screenshot below demonstrates the suggested solution.

When the Network connection of the RT Target is lost, the Read Variable with outputs as Timed out = True. The RT Target implements the commands in the Case structure. When the connection is recovered, the Timed out becomes False.