in_addr(3type)

in_addr3type

Socket address

Part of sockaddr(3type).

Usage

#include <sys/socket.h>

struct sockaddr { sa_family_t sa_family; /* Address family */ char sa_data[]; /* Socket address */ };

struct sockaddr_storage { sa_family_t ss_family; /* Address family */ };

typedef /* ... */ socklen_t; typedef /* ... */ sa_family_t;

Library

Standard C library (libc)

Overview

sockaddr

Describes a socket address.

sockaddr_storage

A structure at least as large as any other sockaddr_* address structures. It's aligned so that a pointer to it can be cast as a pointer to other sockaddr_* structures and used to access its fields.

socklen_t

Describes the length of a socket address. This is an integer type of at least 32 bits.

sa_family_t

Describes a socket's protocol family. This is an unsigned integer type.

Internet domain sockets

See sockaddr_in(3type) and sockaddr_in6(3type).

UNIX domain sockets

See sockaddr_un(3type).

Notes

socklen_t is also defined in <netdb.h>.

sa_family_t is also defined in <netinet/in.h> and <sys/un.h>.

Releases

3 releases since Debian 12 (Bookworm); the text changed 2 times.

  1. 12
  2. 13
  3. Arch

Standards

POSIX.1-2024.

History

POSIX.1-2001.

socklen_t was invented by POSIX. See also accept(2).

These structures were invented before modern ISO C strict-aliasing rules. If aliasing rules are applied strictly, these structures would be extremely difficult to use without invoking undefined behavior. POSIX.1-2024 fixed this by requiring that implementations make sure that these structures can be safely used as they were designed.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.