---
name: "sctp_getladdrs"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/sctp_getladdrs"
---

# sctp\_getladdrs(3)

return a list of addresses to the caller

## NAME

**sctp\_getpaddrs**, **sctp\_getladdrs** – return a list of addresses to the caller

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<sys/socket.h\>**

**#include \<netinet/sctp.h\>**

*int*\

**sctp\_getpaddrs**(*int s*, *sctp\_assoc\_t asocid*, *struct sockaddr \*\*addrs*);

*int*\

**sctp\_getladdrs**(*int s*, *sctp\_assoc\_t asocid*, *struct sockaddr \*\*addrs*);

## DESCRIPTION

The **sctp\_getpaddrs**() function is used to get the list of the peers addresses. The **sctp\_getladdrs**() function is used to get the list of the local addresses. The association of interest is identified by the *asocid* argument. The addresses are returned in a newly allocated array of socket addresses returned in the argument *addrs* upon success.

After the caller is finished, the function **sctp\_freepaddrs**() or **sctp\_freeladdrs**() should be used to release the memory allocated by these calls.

## RETURN VALUES

The call returns -1 upon failure and a count of the number of addresses returned in *addrs* upon success.

## ERRORS

The functions can return the following errors:

- \[EINVAL\]

  An address listed has an invalid family or no addresses were provided.

- \[ENOMEM\]

  The call cannot allocate memory to hold the socket addresses.

- \[EBADF\]

  The argument *s* is not a valid descriptor.

- \[ENOTSOCK\]

  The argument *s* is not a socket.

## SEE ALSO

[getsockopt(2)](/getsockopt/2.md), [sctp\_freeladdrs(3)](/sctp_freeladdrs/3.md), [sctp\_freepaddrs(3)](/sctp_freepaddrs/3.md), [sctp(4)](/sctp/4.md) R. Stewart, M. Tuexen, K. Poon, P. Lei, and V. Yasevich, *Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)*, RFC 6458, December 2011.

## STANDARDS

The **sctp\_getpaddrs**() and **sctp\_getladdrs**() functions conform to RFC 6458.
