Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DgramSocket

DgramSocket is used to create a SOCK_DGRAM unix domain socket. Currently DgramSocket doesn't work with cluster module.

DgramSocket is also an EventEmitter and will emit events including:

Event: 'data'

  • buffer Buffer
  • path string

Emitted when data is received. path indicates remote address information.

Event: 'error'

  • error Error

Emitted when an error occurs.

Event: 'close'

The 'close' event is emitted after a socket is closed with close().

Hierarchy

  • EventEmitter
    • DgramSocket

Index

Constructors

Methods

  • address(): string
  • Returns the bound address.

    Returns string

  • bind(socketPath: string): void
  • Listen for datagram messages on a path.

    Parameters

    • socketPath: string

    Returns void

  • close(): void
  • Close the underlying socket and stop listening for data on it.

    Returns void

  • getRecvBufferSize(): number
  • Returns number

    the SO_RCVBUF socket receive buffer size in bytes.

  • getSendBufferSize(): number
  • Returns number

    the SO_SNDBUF socket send buffer size in bytes.

  • sendTo(buf: Buffer, offset: number, length: number, destPath: string, onWrite?: SendCb): void
  • Send messages to the destination path.

    Parameters

    • buf: Buffer
    • offset: number
    • length: number
    • destPath: string
    • Optional onWrite: SendCb

    Returns void

  • setRecvBufferSize(size: number): void
  • Sets the SO_RCVBUF socket option. Sets the maximum socket receive buffer in bytes.

    Parameters

    • size: number

    Returns void

  • setSendBufferSize(size: number): void
  • Sets the SO_SNDBUF socket option. Sets the maximum socket send buffer in bytes.

    Parameters

    • size: number

    Returns void

Generated using TypeDoc