Table Of Contents

TCP Wait on Listener (G Dataflow)

Last Modified: January 12, 2018

Waits for an accepted TCP network connection.

Programming Patterns

Use this node with TCP Create Listener to create and listen for connections on the server.

connector_pane_image
datatype_icon

listener ID in

A network connection refnum that uniquely identifies the listener.

Use TCP Create Listener to generate a refnum to wire to this input.

datatype_icon

resolve remote address

A Boolean that determines whether to return the remote address as an IP address or as a hostname.

True This node returns the remote address as a hostname.
False This node returns the remote address as an IP address.

Default: True

datatype_icon

timeout ms

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.

datatype_icon

error in

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.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

listener ID out

The same network connection refnum as listener ID in. Use this value to refer to the listener in subsequent calls to this node.

datatype_icon

remote address

The network address of the client that establishes a connection with this server.

datatype_icon

remote port

The port on the client that establishes a connection with the server.

datatype_icon

error out

This node can return the following error codes.

56 The network operation exceeded the user-specified or system time limit. This may occur if the application closes the listener while waiting on the listener.
66 The network operation was closed by the peer. This may occur if the application closes the listener while waiting on the listener.
spd-note-note
Note  

This is not a comprehensive list of errors this node can return.

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.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.
datatype_icon

connection ID

A network connection refnum that uniquely identifies the connection. Use this value to refer to this connection in subsequent node calls.

Why Should I Use TCP Create Listener and TCP Wait on Listener Instead of TCP Listen?

You can choose one of the following techniques to wait for an incoming connection:

  • Use TCP Listen to create a listener and wait for an accepted TCP connection at a specified port.
  • Use TCP Create Listener to create a listener and use TCP Wait on Listener to listen for and accept new connections. TCP Wait on Listener returns the same listener ID you wired to the node.

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: This product does not support FPGA devices

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics