Ende.ServeTcpOptions

interface

interface Ende.ServeTcpOptions extends ServeOptions<Ende.NetAddr>

Options that can be passed to Ende.serve to create a server listening on a TCP port.

Properties

transport

transport?: "tcp"

The transport to use.

port

port?: number

The port to listen on.

Set to 0 to listen on any available port.

Default: 8000

hostname

hostname?: string

A literal IP address or host name that can be resolved to an IP address.

Note about 0.0.0.0 While listening 0.0.0.0 works on all platforms, the browsers on Windows don't work with the address 0.0.0.0. You should show the message like server running on localhost:8080 instead of server running on 0.0.0.0:8080 if your program supports Windows.

Default: "0.0.0.0"

reusePort

reusePort?: boolean

Sets SO_REUSEPORT on POSIX systems.

tcpBacklog

tcpBacklog?: number

Maximum number of pending connections in the listen queue.

This parameter controls how many incoming connections can be queued by the operating system while waiting for the application to accept them. If more connections arrive when the queue is full, they will be refused.

The kernel may adjust this value (e.g., rounding up to the next power of 2 plus 1). Different operating systems have different maximum limits.

Default: 511