@ac-essentials/misc-util
    Preparing search index...

    Class StreamSocket<TSock, TEvents>

    Base class for stream-oriented client sockets.

    This abstraction wraps a net.Socket instance and exposes:

    It is intentionally transport-agnostic: it does not assume a particular address family or protocol. Concrete subclasses such as TcpClient add protocol-specific concerns (for example InetEndpoint accessors, TCP keep-alive configuration, or DNS resolution events) on top of this base.

    Unless explicitly documented otherwise, methods mirror the semantics of their underlying net.Socket counterparts.

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    handledErrorEvents: Set<Error> = ...
    sock: TSock

    The underlying Node.js socket.

    Accessors

    • get timeout(): number | null

      Current inactivity timeout in milliseconds, or null if disabled.

      Returns number | null

    • set timeout(timeout: number | null): void

      Updates the inactivity timeout for the socket.

      When set to a positive number, the socket emits a "timeout" event if no I/O activity occurs within the given number of milliseconds. A value of 0 or null disables the timeout entirely.

      Parameters

      • timeout: number | null

      Returns void

    Methods

    • Immediately destroys the underlying socket.

      Pending I/O is discarded, the connection is closed and the socket transitions to a terminal state. Any registered "close" listeners will still be invoked.

      Returns void

    • Half-closes the socket, optionally waiting for a full close.

      If waitForClose is omitted or false, the promise resolves once the local side has finished sending data and the FIN has been queued. When waitForClose is true, the promise resolves only after the remote side has also closed and the "close" event has fired.

      Parameters

      • Optionaloptions: { waitForClose?: boolean }

        Optional settings for ending the socket.

      Returns Promise<void>

      A promise that resolves once the socket has ended.