Developer Center Resources

cancel
Showing results for 
Search instead for 
Did you mean: 

Inter-Application Communication: TCP

 

» Inter-Application Communication » TCP

Description

TCP is one of the core communication protocols used by the Internet and many similar networks.

 

The TCP protocol can also be used by applications to communicate across a network or on the same machine. One application typically acts as a server and opens up a TCP port, the other application acts as a client and connects to the server’s TCP port.

TCP 01.png

Using the TCP protocol, LabVIEW can connect to and communicate with third-party software. LabVIEW includes a number of VIs that allow the user to communicate using the TCP protocol. A third-party application would need to be able to connect to or open a TCP port so that it could receive and send data to a LabVIEW application.

 

The data sent using TCP is formatted as bytes (or characters), so the sender needs to flatten the data to a byte array (or string) and the receiver has to parse the data once it receives it.

 

One of the main advantages of TCP is that it can be used across a variety of operating systems, since it is based off the Internet Protocol Suite and not a specific OS. One of the main disadvantages is that the user will have to modify their network security settings to allow communication across whatever port they choose.

 

The nature of TCP/IP communication allows LabVIEW and the third-party application to stream real-time data.

Example Use-Case

The LabVIEW Simulation Interface Toolkit connects LabVIEW  with The MathWorks, Inc. MATLAB® and Simulink® using TCP communication in order to run simulations with a model from MATLAB® or Simulink® in conjunction with a user interface or data stimulus from LabVIEW.

TCP 02.png

Running a Simulink® Model in LabVIEW

MATLAB® and Simulink® are registered trademarks of The MathWorks, Inc.

 

The component that handles the TCP connection is called the "SIT Server", which is configured by the user to seamlessly connect the two software environments. In other words, the underlying TCP code is not exposed to the user.

Code Example

The following examples can be found from the NI Example Finder in LabVIEW, by navigating to Help»Find Examples...

  • Simple Data Client.vi, Simple Data Server.vi
  • Data Client.vi, Data Server.vi
  • UDP Receiver.vi, UDP Sender.vi

Additional Resources

Developer Zone Tutorial: Basic TCP/IP Communication in LabVIEW
Training LabVIEW Connectivity

Inter-Application Communication using TCP and .NET Remoting

 

Jervin Justin
NI TestStand Product Manager