Hierarchy

  • Server
    • TCPServer

Constructors

Accessors

Methods

Constructors

  • Constructs a new instance of the server

    Parameters

    • options: ServerOpts = {}
    • Optional connectionListener: ((socket) => void)
        • (socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns TCPServer

Accessors

  • get bindIP(): string
  • Returns the interface address that the server is bound to

    Returns string

  • get bindPort(): number
  • Returns the interface port that the server is bound to

    Returns number

  • get sockets(): Socket[]
  • Returns an iterator of currently connected sockets

    Returns Socket[]

Methods

  • Starts the TCP server

    Parameters

    • Optional port: number
    • Optional hostname: string
    • backlog: number = 511

    Returns Promise<void>

  • Destroys all connected sockets and stops the TCP server

    Returns Promise<void>

  • Creates a new TCP server with the provided options

    Parameters

    • options: ServerOpts = {}
    • Optional connectionListener: ((socket) => void)
        • (socket): void
        • Parameters

          • socket: Socket

          Returns void

    Returns TCPServer