Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Creating a TCP Client

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

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


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit