Complete the following steps to create a TCP client using the TCP functions.
- (Optional) Create a TCP server. When you create a TCP server, you specify the remote port or service name to represent the port you want the server to use for communication.
- Use the TCP Open Connection function to open a connection to a server. You must specify the remote port or service name for the server. The remote port or service name identifies a communication channel on the computer that the server uses to listen for communication requests.
If you specify a service name, LabVIEW queries the NI Service Locator for the port number that the server registered.If you want to establish a connection to a remote computer, you must specify the Internet address of the server. The address identifies a computer on the network. If you do not specify an address, LabVIEW establishes a connection to the local computer.
- Use the TCP Read function to read a message from the server. You must specify the number of bytes you want to read.
- Use the TCP Write function to send a message to a server.
- Use the TCP Close Connection function to close the connection to the server.
Refer to the following VIs for examples of a TCP client:
- labview\examples\comm\TCP.llb\Simple Data Client.vi
- labview\examples\comm\TCP.llb\Named Service TCP Client.vi