Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
class UDP
extends HandleWrap
import { UDP } from "https://deno.land/std@0.146.0/node/internal_binding/udp_wrap.ts";

Constructors

new
UDP()

Properties

lookup: (address: string, callback: (
err: ErrnoException | null,
address: string,
family: number,
) => void
) => GetAddrInfoReqWrap | Record<string, never>
onmessage: (
nread: number,
handle: UDP,
buf?: Buffer,
rinfo?: { address: string; family: "IPv4" | "IPv6"; port: number; size?: number; },
) => void
[ownerSymbol]: unknown

Methods

_onClose(): number

Handle socket closure.

addMembership(_multicastAddress: string, _interfaceAddress?: string): number
addSourceSpecificMembership(
_sourceAddress: string,
_groupAddress: string,
_interfaceAddress?: string,
): number
bind(
ip: string,
port: number,
flags: number,
): number

Bind to an IPv4 address.

bind6(
ip: string,
port: number,
flags: number,
): number

Bind to an IPv6 address.

bufferSize(
size: number,
buffer: boolean,
ctx: Record<string, string | number>,
): number | undefined
connect(ip: string, port: number): number
connect6(ip: string, port: number): number
disconnect(): number
dropMembership(_multicastAddress: string, _interfaceAddress?: string): number
dropSourceSpecificMembership(
_sourceAddress: string,
_groupAddress: string,
_interfaceAddress?: string,
): number
getpeername(peername: Record<string, string | number>): number

Populates the provided object with remote address entries.

getsockname(sockname: Record<string, string | number>): number

Populates the provided object with local address entries.

open(_fd: number): number

Opens a file descriptor.

recvStart(): number

Start receiving on the connection.

recvStop(): number

Stop receiving on the connection.

ref(): void
send(
req: SendWrap,
bufs: MessageType[],
count: number,
...args: [number, string, boolean] | [boolean],
): number
send6(
req: SendWrap,
bufs: MessageType[],
count: number,
...args: [number, string, boolean] | [boolean],
): number
setBroadcast(_bool: 0 | 1): number
setMulticastInterface(_interfaceAddress: string): number
setMulticastLoopback(_bool: 0 | 1): number
setMulticastTTL(_ttl: number): number
setTTL(_ttl: number): number
unref(): void