Coconstructor
Bun

constructor

net.SocketAddress.constructor

Not implemented in Bun

constructor SocketAddress(

Referenced types

interface SocketAddressInitOptions

  • address?: string

    The network address as either an IPv4 or IPv6 string.

  • flowlabel?: number

    An IPv6 flow-label used only if family is 'ipv6'.

  • port?: number

    An IP port.

  • readonly address: string

    Either 'ipv4' or 'ipv6'.

  • readonly family: IPVersion

    Either 'ipv4' or 'ipv6'.

  • readonly flowlabel: number
  • readonly port: number
  • static parse(
    input: string
    ): undefined | SocketAddress;
    @param input

    An input string containing an IP address and optional port, e.g. 123.1.2.3:1234 or [1::1]:1234.

    @returns

    Returns a SocketAddress if parsing was successful. Otherwise returns undefined.