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

TCP Open Connection Function

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Owning Palette: TCP VI and Functions

Requires: Base Development System

Opens a TCP network connection with the address and remote port or service name.

Use the TCP Close Connection function to close the connection.

Details  Example

address is the address with which you want to establish a connection. This address can be in IP dot notation or it can be a hostname. If you do not specify an address, LabVIEW establishes a connection to the local computer.
remote port or service name can accept a numeric or a string input. remote port or service name is the port or name of the service with which you want to establish a connection. If you specify a service name, LabVIEW queries the NI Service Locator for the port number that the server registered. If you wire a value of 0, LabVIEW returns an error.
timeout ms specifies the time, in milliseconds, that the function waits to complete and return an error. The default value is 60,000 ms or 1 minute. A value of –1 indicates to wait indefinitely.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
local port is the local connection port. Some servers only allow connections to clients that use port numbers within a specific range that is dependent on the server. If the value is 0, the operating system selects an unused port. The default is 0.
connection ID is a network connection refnum that uniquely identifies the TCP connection. Use this value to refer to this connection in subsequent VI calls.
error out contains error information. This output provides standard error out functionality.

TCP Open Connection Details

When wiring an unused IP address, you may receive an error stating the network operation exceeded the user-specified or system time limit. This error occurs before the default timeout of 60000 ms has occurred. To correct this error, wire an IP address that is running and listening on the port you are trying to use.

Example

Refer to the TCP Named Service.lvproj in the labview\examples\Data Communication\Protocols\TCP\TCP Named Service directory for an example of using the TCP Open Connection function.


 

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