» Inter-Application Communication » TCP
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.
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.
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.
|
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.
The following examples can be found from the NI Example Finder in LabVIEW, by navigating to Help»Find Examples...
Developer Zone Tutorial: Basic TCP/IP Communication in LabVIEW
Training LabVIEW Connectivity
Inter-Application Communication using TCP and .NET Remoting