From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI User Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI Tip: Transferring Data over a Network

Contents

  1. When to Use Network Streams Instead of Network Variables?
  2. Network Streams vs. TCP/IP vs. Network Variables
  3. Overview of the Network Streams Library

When to Use Network Streams Instead of Network Variables?

When choosing networking features for your applications, the most important factors are the communication models that your applications use. Different communication models have different data transfer requirements that different networking features are designed to fulfill. Use network variables to publish the latest value in a data set to one or more subscribers. Use network streams to send every point of data from one writer to one reader. Because network variables are optimized for publishing the latest value of data only, they could miss a critical data point. However, network streams would stream every point of data to the desktop computer so you could monitor the condition of the engine.

The following table describes the most common communication models and recommends a networking feature for each.

Communication ModelDescriptionExampleRecommended Networking Feature
Process data The transfer of latest values only, typically from one or more targets to a host computer. An application in which an distributed controller acquires temperature data and periodically transfers a data point to the host computer so users can monitor the state of the system. Network variables
StreamingThe high-throughput transfer of every data point, typically from one computer that writes data to another computer that reads and displays or processes that data. An application in which an distributed controller acquires vibration data from a motor and streams every point of that data to a host computer for analysis and processing. Network streams
Command-basedLow-latency data transfer from one computer, known as the commander, that triggers a specific event on another computer, the worker. Command-based communication is typically infrequent and requires that you do not miss any data points. When a user clicks the stop button in a human-machine interface (HMI) application, that application shuts down a conveyer belt by sending the stop command to the target controlling the conveyer belt. Network streams

Network Streams vs. TCP/IP vs. Network Variables

Depending on the OSes your computers run and the applications you are transferring data to, you might need to use networking features other than those outlined in the table above. Click on the following flowchart to determine the networking features that best fit your application needs.

Network Data Flow Chart.png

Overview of the Network Streams Library

New in LabWindows/CVI 2013, the Network Streams API provides lossless, unidirectional, one-to-one communication channel between distributed LabWindows/CVI or LabVIEW applications. Using network streams, you can easily share data across the network or on the same computer. Network streams are an easy-to-configure, tightly integrated, and dynamic communication method for transferring data from one application to another with throughput and latency characteristics that are comparable with TCP. Network streams also have enhanced connection management that automatically restores network connectivity if a disconnection occurs due to a network outage or other system failure.  Streams use a buffered, lossless communication strategy that ensures data written to the stream is never lost, even in environments that have intermittent network connectivity.

Fig 3. Network streams provide a protocol and API for sending measurement data across networked applications without losing any data points.

Specific Uses for Network Streams

Network streams were designed and optimized for lossless, high throughput data communication.  Network streams use a one-way, point-to-point buffered communication model to transmit data between applications.  This means that one of the endpoints is the writer of data and the other is the reader.  You can accomplish bidirectional communication by using two streams, where each computer contains a reader and a writer that is paired to a writer and reader on the opposite computer.

Because streams were built with throughput characteristics comparable to those of raw TCP, streams are ideal for high throughput applications where the programmer wants to avoid the complexity of using TCP.  Streams can also be used for lossless, low throughput communication such as sending and receiving commands.  However, using streams for low throughput communication may require more explicit management over when data is transmitted through the stream if the absolute lowest latency is desired.

Note  Network streams can induce jitter in real-time (RT), time-critical loops. Therefore, if you want to stream data from a time-critical loop with network streams, National Instruments recommends that you first share the data with a lower-priority loop. Then, use network streams to stream the data to another application.

Did you find this tip useful? Rate this document or add a comment below.

If you give this a try, share your experience! Add a comment below.

National Instruments
Contributors