Skip to content

API reference / @jsprismarine/raknet / UdpDatagramSource

Class: UdpDatagramSource ​

Defined in: raknet/src/DatagramSource.ts:37

A UDP socket of RakNet's own. An IPv6 address binds an IPv6-only socket, so the IPv4 and IPv6 listeners of one server never contend for the same traffic.

Implements ​

Constructors ​

Constructor ​

new UdpDatagramSource(logger, socketBufferOptions?): UdpDatagramSource

Defined in: raknet/src/DatagramSource.ts:44

Parameters ​

logger ​

Logger

Where buffer sizes and send failures are reported.

socketBufferOptions? ​

SocketBufferOptions = {}

Requested UDP buffers, which the OS may cap.

Returns ​

UdpDatagramSource

Methods ​

close() ​

close(): void

Defined in: raknet/src/DatagramSource.ts:84

Closes the socket.

Returns ​

void

Implementation of ​

DatagramSource.close


send() ​

send(buffers, port, address): void

Defined in: raknet/src/DatagramSource.ts:71

Sends from the socket; see DatagramSource.send.

Parameters ​

buffers ​

Buffer<ArrayBufferLike> | readonly Buffer<ArrayBufferLike>[]

port ​

number

address ​

string

Returns ​

void

Implementation of ​

DatagramSource.send


start() ​

start(address, port, listener): Promise<number>

Defined in: raknet/src/DatagramSource.ts:50

Binds the socket; see DatagramSource.start.

Parameters ​

address ​

string

port ​

number

listener ​

DatagramListener

Returns ​

Promise<number>

Implementation of ​

DatagramSource.start