Skip to main content

Function: listen()

Call Signature

listen(transport, host, port?, options?): Promise<TCPServerSocket>

Listens for incoming connections on the selected transport. Returns the appropriate Direct Sockets object.

Parameters

transport

"tcp"

Transport type.

host

string

Hostname for listening on.

port?

number

Listening port (where applicable).

options?

ListenOptions

Extra listen options.

Returns

Promise<TCPServerSocket>

Call Signature

listen(transport, host, options?): Promise<PipeServerSocket>

Listens for incoming connections on the selected transport. Returns the appropriate Direct Sockets object.

Parameters

transport

"pipe"

Transport type.

host

string

Hostname for listening on.

options?

ListenOptions

Extra listen options.

Returns

Promise<PipeServerSocket>

Call Signature

listen(transport, host?, port?, options?): Promise<UDPSocket>

Listens for incoming connections on the selected transport. Returns the appropriate Direct Sockets object.

Parameters

transport

"udp"

Transport type.

host?

string

Hostname for listening on.

port?

number

Listening port (where applicable).

options?

ListenOptions

Extra listen options.

Returns

Promise<UDPSocket>