udpcreatesocket

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUDPSocket

func CreateUDPSocket(addressFamily IPAddressFamily) (result cm.Result[UDPSocket, UDPSocket, ErrorCode])

CreateUDPSocket represents the imported function "create-udp-socket".

Create a new UDP socket.

Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.

This function does not require a network capability handle. This is considered to be safe because at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.

All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.

# Typical errors - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)

# References: - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html> - <https://man7.org/linux/man-pages/man2/socket.2.html> - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw> - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>

create-udp-socket: func(address-family: ip-address-family) -> result<udp-socket,
error-code>

Types

type ErrorCode added in v0.34.0

type ErrorCode = network.ErrorCode

ErrorCode represents the type alias "wasi:sockets/udp-create-socket@0.2.0#error-code".

See network.ErrorCode for more information.

type IPAddressFamily added in v0.34.0

type IPAddressFamily = network.IPAddressFamily

IPAddressFamily represents the type alias "wasi:sockets/udp-create-socket@0.2.0#ip-address-family".

See network.IPAddressFamily for more information.

type Network added in v0.34.0

type Network = network.Network

Network represents the imported type alias "wasi:sockets/udp-create-socket@0.2.0#network".

See network.Network for more information.

type UDPSocket added in v0.34.0

type UDPSocket = udp.UDPSocket

UDPSocket represents the imported type alias "wasi:sockets/udp-create-socket@0.2.0#udp-socket".

See udp.UDPSocket for more information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL