---
title: "port_addr_add()"
description: "Adds another static address to the local port."
url: "https://wasix.org/docs/api-reference/wasix/port_addr_add/"
markdown: "https://wasix.org/docs/api-reference/wasix/port_addr_add.md"
---

# `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

```ebnf
  ;;; 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 and `prefix` 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.

---

[Documentation index](https://wasix.org/llms.txt) · [HTML version](https://wasix.org/docs/api-reference/wasix/port_addr_add/)
