Creates a listener and waits for an accepted TCP network connection at the specified port.
The network address of a network interface on the local device where this node listens for data.
Default: 0
The name you want to associate with the port number that this node is listening for connections on.
If you specify a service name, this node registers the service name and the associated port number with the NI Service Locator. A client can then use this service name to query the NI Service Locator for the port number associated with that service name. By using registered service names, clients can establish connections with the server without specifying a port number.
What Is the NI Service Locator?
The NI Service Locator stores a list of registered service names and returns a corresponding port number to clients that query for a particular service name.
A client can use a service name to query the NI Service Locator and obtain the port number associated with that service name. Thus, a client does not need to know the port number of a registered service in order to request that service.
The NI Service Locator runs as a background service and requires no user interaction.
Registering Services with the NI Service Locator
Use this input to register a service name and associated port number with the NI Service Locator.
The port number where you want to listen for a connection.
By default, this node dynamically chooses an available TCP port to listen for connections on.
The following table lists valid port numbers as defined by the Internet Assigned Numbers Authority (IANA).
Type | Range |
---|---|
System/Well-Known Ports | 0 through 1023 |
User/Registered Ports | 1024 through 49151 |
Dynamic/Private Ports | 49152 through 65535 |
Time, in milliseconds, that the node waits for a connection. If the node cannot establish a connection in the specified time, the node returns an error.
Default: -1 — This node waits indefinitely for a connection.
Error conditions that occur before this node runs.
The node responds to this input according to standard error behavior.
Standard Error Behavior
Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.
Default: No error
A network connection refnum that uniquely identifies the listener.
A network connection refnum that uniquely identifies the connection. Use this value to refer to this connection in subsequent node calls.
The network address of the client that establishes a connection with this server.
The port on the client that establishes a connection with the server.
This node can return the following error codes.
54 | The network address is invalid. |
59 | Network driver error. |
60 | The requested port is already in use. |
Standard Error Behavior
Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.
You can choose one of the following techniques to wait for an incoming connection:
The advantage of using TCP Create Listener and TCP Wait on Listener is that you can listen for a connection without using a timeout. You can also explicitly close the listener, or you can cancel the listen when another condition becomes true.
Where This Node Can Run:
Desktop OS: Windows
FPGA: Not supported
Web Server: Not supported in VIs that run in a web application