port_addr_add()
Adds another static address to the local port.
Description
The port_addr_add()
function is used to add an additional static address to the local port. This allows the port to listen on multiple IP addresses.
Syntax
;;; Adds another static address to the local port
(@interface func (export "port_addr_add")
;;; Address to be added
(param $addr (@witx const_pointer $addr_cidr))
(result $error (expected (error $errno)))
)
Parameters
ctx
: A mutable reference to the function environment.ip
: A WebAssembly pointer to a__wasi_cidr_t
structure that represents the IP address and prefix length of the address to be added.
Return Value
The function returns a Result
indicating the outcome of the operation. If the operation is successful, Ok(Errno::Success)
is returned. If an error occurs, an appropriate WasiError
is returned.
Notes
- The
port_addr_add()
function adds another static address to the local port, allowing the port to listen on multiple IP addresses. - The
__wasi_cidr_t
structure represents an IP address and prefix length. It contains two fields:ip
for the IP address andprefix
for the prefix length. - The behavior and limitations of the
port_addr_add()
function may vary depending on the specific runtime environment and underlying networking implementation. It is important to consult the documentation or specifications of the specific environment to understand its behavior in that context.