@pumpkin-plugins/upnpumpkin API / platform/wasi-network / WasiNetwork
Class: WasiNetwork
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:184
The Network the port mapping code runs on, over WASI UDP and TCP sockets. A UDP socket lets the operating system choose the local interface without sending a packet.
Param
sockets
The host's sockets, from wasiSockets on a real server.
Implements
Methods
dial()
dial(
to):Dial
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:211
Starts a TCP connection.
Parameters
to
Returns
Implementation of
localAddress()
localAddress(
toward?):Ipv4|undefined
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:216
The address this machine uses to reach toward, or the internet when that is omitted.
Parameters
toward?
Ipv4 = INTERNET
Returns
Ipv4 | undefined
The address, or undefined when there is no route.
Implementation of
now()
now():
number
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:188
The current time in milliseconds.
Returns
number
Implementation of
openDatagram()
openDatagram():
DatagramSocket
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:198
Opens a UDP socket bound to any free port.
Returns
Implementation of
pause()
pause(
ms):void
Defined in: packages/upnpumpkin/src/platform/wasi-network.ts:193
Blocks the caller for about ms milliseconds without using the CPU. Only for code that is allowed to block, such as a shutdown waiting for the router. Without it such code polls in a loop.
Parameters
ms
number
Returns
void