Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SeqpacketSocket

SeqpacketSocket is an abstraction of a SOCK_SEQPACKET socket.

SeqpacketSocket is also an EventEmitter and will emit events including:

Event: 'connect'

Emitted when a socket connection is successfully established.

Event: 'data'

  • buffer Buffer Emitted when data is received. All message boundaries in incoming datagrams are preserved.

Event: 'end'

Emitted when the other end of the socket signals the end of transmission, thus ending the readable side of the socket.

Event: 'error'

  • error Error Emitted when an error occurs. The 'close' event will be called directly following this event.

Event: 'close'

Emitted once the socket is fully closed.

Hierarchy

  • EventEmitter
    • SeqpacketSocket

Index

Constructors

Methods

  • connect(serverPath: string, connectCb?: NotifyCb): void
  • Initiate a connection on a given socket.

    This function is asynchronous. When the connection is established, the 'connect' event will be emitted. However, connect() will throw error synchronously if the 'serverPath' is not a valid Seqpacket server.

    Parameters

    • serverPath: string
    • Optional connectCb: NotifyCb

    Returns void

  • destroy(): void
  • Ensures that no more I/O activity happens on this socket. Destroys the stream and closes the connection.

    Returns void

  • Half-closes the socket. i.e., it sends a FIN packet. It is possible the server will still send some data.

    Parameters

    Returns void

  • getInternalReadBufferSize(): number
  • Return the size of buffer that SeqpacketSocket uses to receive data. The data will be truncated if the buffer size is not large enough.

    Default size is 256KB.

    Returns number

  • ref(): void
  • Reference the socket so that it will prevent Node.js process from exiting automatically.

    Returns void

  • setInternalReadBufferSize(size: number): void
  • Set the size of buffer that SeqpacketSocket uses to receive data.

    Parameters

    • size: number

    Returns void

  • unref(): void
  • Unreference the socket so that it won't prevent Node.js process from exiting automatically.

    Returns void

  • write(buf: Buffer, offset?: number, length?: number, cb?: NotifyCb): void
  • Sends data on the socket. The cb is called when data is written to operating system.

    Parameters

    • buf: Buffer
    • Optional offset: number
    • Optional length: number
    • Optional cb: NotifyCb

    Returns void

Generated using TypeDoc