Skip to content

@pumpkin-plugins/port-mapping API / steps / udpRequest

Function: udpRequest() ​

udpRequest<T>(net, socket, to, packet, accept, timeouts): Steps<T>

Defined in: tools/port-mapping/src/steps.ts:17

Sends a datagram and waits for an answer, sending again after each timeout.

Type Parameters ​

T ​

T

Parameters ​

net ​

Network

socket ​

DatagramSocket

to ​

Endpoint

packet ​

Uint8Array

accept ​

(datagram) => T | undefined

Reads a datagram that arrived, returning undefined for ones that aren't the answer.

timeouts ​

readonly number[]

How long to wait after each send, in milliseconds. One send per entry.

Returns ​

Steps<T>

Throws ​

When none of the sends was answered.

Pumpkin Plugins documentation