Creating a TCP Client

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2015 Help
LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help

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.

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

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

  5. 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\Data Communication\Protocols\TCP\TCP Named Service\TCP Named Service.lvproj


Not Helpful