nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version v1.1.0 of nng, but the latest released version is v1.8.0. see the documentation for v1.8.0 for the most up-to-date information.


#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;


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:


This field will always have the value NNG_AF_INET.


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.


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

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).
This field appears similar to BSD sockaddr_in, but it is not the same, and they may not be used interchangeably.
NNG Reference Manual vv1.1.0 © 2019 Staysail Systems, Inc, © 2018 Capitar IT Group BV
This document is supplied under the MIT License.
nanomsg™ and nng™ are trademarks of Garrett D'Amore.