table of contents
NNG_SOCKADDR_IN(5) | NNG Reference Manual | NNG_SOCKADDR_IN(5) |
NAME¶
nng_sockaddr_in - IPv4 socket address
SYNOPSIS¶
#include <nng/nng.h> enum sockaddr_family {
NNG_AF_INET = 3, }; typedef struct {
uint16_t sa_family;
uint16_t sa_port;
uint32_t sa_addr; } nng_sockaddr_in;
DESCRIPTION¶
An nng_sockaddr_in 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 IPv4 addresses. A different structure, nng_sockaddr_in6, is used for IPv6 addresses.
The following structure members are present:
sa_family
sa_port
sa_addr
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_in).
Important
This field appears similar to BSD
sockaddr_in, but it is
not the same, and they may not be used interchangeably.
SEE ALSO¶
2024-10-11 |