API reference
Preparing search index…

UdpSocket

UDP socket preserving datagram boundaries; Packet data has no TCP length header.

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory33

Constructors

Properties

Methods

Constructors

Properties

blocking: boolean = true
Source & inheritance
detach?: () => void

Remove event listeners from the current transport.

Source & inheritance
epoch: number = 0
Source & inheritance
failure?: Error
Source & inheritance
transport?: Socket

Underlying UDP socket handle.

Source & inheritance
AnyPort: 0

Let the system assign an available port when binding.

Source & inheritance
MaxDatagramSize: 65507

Maximum UDP datagram payload size in bytes allowed by this implementation.

Source & inheritance
Status: typeof SocketStatus = SocketStatus

Socket operation status enumeration.

Source & inheritance
Type: typeof SocketType = SocketType

Socket transport protocol enumeration.

Source & inheritance

Methods

  • Parameters

    check
    () => boolean
    generation
    number

    Returns

    Promise<boolean>
    Source & inheritance
  • Close the current transport and wake waits from the previous generation. Repeated calls are safe; the blocking flag is unchanged.

    Returns

    void
    Source & inheritance
  • Return the latest underlying error, or undefined if none is recorded.

    Returns

    undefined | Error
    Source & inheritance
  • Return the bound local port, or 0 when unbound.

    Returns

    number
    Source & inheritance
  • Receive one complete datagram; discard it and return Error if the destination byte buffer is too small. With no data, nonblocking mode returns NotReady.

    Parameters

    destination
    Uint8Array | Packet

    Returns

    Source & inheritance
  • Set whether to wait asynchronously for readability/writability. When false, return NotReady or Partial according to current queue state.

    Parameters

    blocking
    boolean

    Returns

    void
    Source & inheritance
  • Close the UDP transport and clear datagrams pending receipt.

    Returns

    void
    Source & inheritance

Symbol members

"[socketEvents]": EventEmitter<DefaultEventMap> = ...
Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0