Skip to content

TCP Server

The TCP Server class provides the ability to accept incoming TCP connections.

import TCPServer from "embedded:io/tcp-server";

Creates a new TCP server object instance.

TCPServer(options)

options

io - An IO constructor options object for the underlying TCP listener socket.

port - The port number to listen on.

The port the server is listening on.

server.port

Closes the TCP server and all active connections.

close()

A method that is called when a new client connection is available.

tcpReadable(count)

count - The number of available connections.

A TCP Server Connection instance.

TCP Server Class Pattern