---
name: "nng_sockaddr_in6"
section: "5"
platform: "linux"
package: "libnng-dev"
version: "1.10.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/nng_sockaddr_in6"
---

# nng\_sockaddr\_in6(5)

IPv6 socket address

## NAME

nng\_sockaddr\_in6 - IPv6 socket address

## SYNOPSIS

```
#include <nng/nng.h>
enum sockaddr_family {
    NNG_AF_INET6 = 4,
};
typedef struct {
    uint16_t sa_family;
    uint16_t sa_port;
    uint8_t  sa_addr[16];
    uint32_t sa_scope;
} nng_sockaddr_in6;
```

## DESCRIPTION

An `nng_sockaddr_in6` is the flavor of `nng_sockaddr` used to represent TCP (and sometimes UDP) addresses, including the Internet Protocol (IP) address and port number.

This structure is used with IPv6 addresses. A different structure, `nng_sockaddr_in`, is used for IPv4 addresses.

The following structure members are present:

`sa_family`

This field will always have the value `NNG_AF_INET6`.

`sa_port`

This field holds the TCP or UDP port number, in network byte-order. A zero value here is used when no specific port number is indicated.

`sa_addr`

This field holds the IP address in network-byte order.

`sa_scope`

This is the scope, and is typically used with link local addresses to identify a specific interface.  The details of this are specific to the operating system.  This value is presented identically to the underlying system’s, including any byte order considerations.

**Tip**\

The `sa_port` and `sa_addr` fields are in network-byte order to facilitate their use with system APIs such as `inet_ntop()`. Most platforms use some form of BSD-derived network API, which uses network-byte order in the various structures (such as `sockaddr_in6`).

**Important**\

This field appears similar to BSD `sockaddr_in6`, but it is *not* the same, and they may not be used interchangeably.

## SEE ALSO

[nng\_sockaddr(5)](/nng_sockaddr/5.md), [nng\_sockaddr\_in(5)](/nng_sockaddr_in/5.md), [nng\_tcp(7)](/nng_tcp/7.md), [nng(7)](/nng/7.md)
