Troubleshooting Network Stream Timeouts

Updated Aug 22, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW Real-Time Module

Issue Details

I am using Network Streams to communicate between my Host and Real-Time target. When using Network Stream functions such as the Read Single Element from Stream or Write Single Element to Stream, the 'timed out?' output of returns True, indicating a timeout. How can I troubleshoot this?

Solution

The cause of Network Stream timeouts are different for the Reader functions and the Writer functions:


Timeout at Reader functions


These timeouts occur because the Reader function is not acquiring data within the specified timeout. To troubleshoot this, we can do the following: Change the timeout value to -1 (infinite timeout) to see if data is being read at all:
  • If the program hangs at the Reader function, this means that:
    • Data has not been written to the Network Stream. Ensure that your Writer side has established a connection and is writing data to the Network Stream.
    • The connection has been lost from the Reader side of the Network Stream. Check that the connection has not been lost. We can first do so by pinging the target from the host. Programmatically, we can do this by using Watchdog VIs to check for connection failure.
  • If the program does not hang at the Reader function, then likely your timeout value is too low. Increase the timeout value to remove the timeouts.
 

Timeout at Writer functions


Timeouts at Writer functions occur for the following reasons:
  • The connection between the host and the target has been lost. This can again be checked by pinging the device or with Watchdog VIs
  • There is not yet data to be written to the writer function. Use probes or Execution Highlighting to see if data is available to be written to the Network Stream. 
  • The timeout is too low. Try increasing the timeout to give the Writer function more time to write to the Network Stream.

 

Additional Information

Network Streams will buffer data so as long as the connection is not broken and the Reader function keeps returning values, your data will not be lost.