Creating a TCP Client

Complete the following steps to create a TCP client using the TCP functions.

  1. (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.
  2. 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.

     Add  Find
  3. Use the TCP Read function to read a message from the server. You must specify the number of bytes you want to read.

     Add  Find
  4. Use the TCP Write function to send a message to a server.

     Add  Find
  5. Use the TCP Close Connection function to close the connection to the server.

     Add  Find

Refer to the following VIs for examples of a TCP client: