Solution
DataSocket and VI Server technology are based on the TCP protocol. Therefore, DataSocket, VI Server, and TCP calls ultimately communicate in the same way. Both LabVIEW and CVI access the same socket services (that is, the Winsock API in Windows) of the operating system they are running on to perform TCP-based communication. For example, on Windows, a VI might use the DataSocket functions, which would call various WinSock API functions that perform the necessary steps to communicate with the host using the TCP/IP protocol.
The basic mechanism behind TCP/IP communication is that a client, such as a VI in LabVIEW, specifies an IP address (or name) and port number to access. An example is www.ni.com on port 80:
www.ni.com:80
When your application attempts to connect to a port on another computer, the operating system first opens a local port on your computer through which to communicate. The operating system chooses this port and does not need to be known by you, but note that it is unique to this one connection. The server listening at the destination port accepts your request for a connection and is informed of the local port to which to send data. If the server supports it, you can establish multiple connections on a remote port, but each connection from the local computer to a server has a unique local port on which to listen and receive data.
To communicate with an application on another computer using TCP/IP, you need the following information:
- Communication protocol, such as TCP/IP
- Local IP address and a unique port
- Remote IP address and port
Your LabVIEW or CVI applications can establish multiple connections to a server using DataSocket or TCP functions, and each connection opens a new unique port on your local computer.