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

# sctp\_getaddrlen(3)

return the address length of an address family

## NAME

**sctp\_getaddrlen** – return the address length of an address family

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

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

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

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

*int*\

**sctp\_getaddrlen**(*sa\_family\_t family*);

## DESCRIPTION

The **sctp\_getaddrlen**() function returns the size of a specific address family. This function is provided for application binary compatibility since it provides the application with the size the operating system thinks the specific address family is. Note that the function will actually create an SCTP socket and then gather the information via a **getsockopt**() system calls. If for some reason a SCTP socket cannot be created or the **getsockopt**() call fails, an error will be returned with *errno* set as specified in the **socket**() or **getsockopt**() system call.

## RETURN VALUES

The call returns the number of bytes that the operating system expects for the specific address family or -1.

## ERRORS

The **sctp\_getaddrlen**() function can return the following errors:

- \[EINVAL\]

  The address family specified does NOT exist.

## SEE ALSO

[getsockopt(2)](/getsockopt/2.md), [socket(2)](/socket/2.md), [sctp(4)](/sctp/4.md)
