NNG_SOCKADDR(5)
π NNG_SOCKADDR π
okay bestie, gather round, we're talking about nng_sockaddr, the socket address situation. this is from the NNG Reference Manual, page NNG_SOCKADDR(5), and it's giving "I contain multitudes." let's get into it β¨
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
typedef union nng_sockaddr {
uint16_t s_family;
nng_sockaddr_ipc s_ipc;
nng_sockaddr_inproc s_inproc;
nng_sockaddr_in s_in;
nng_sockaddr_in6 s_in6;
nng_sockaddr_zt s_zt;
nng_sockaddr_abstract s_abstract;
} nng_sockaddr;
enum sockaddr_family {
NNG_AF_UNSPEC = 0,
NNG_AF_INPROC = 1,
NNG_AF_IPC = 2,
NNG_AF_INET = 3,
NNG_AF_INET6 = 4,
NNG_AF_ZT = 5,
NNG_AF_ABSTRACT = 6
};
π¦ DESCRIPTION π¦
so an nng_sockaddr is this structure that's used for representing the addresses that the underlying transports use β think TCP/IP addresses, IPC paths, all of that π
real talk: the namesockaddris based on how similar it is to POSIXstruct sockaddr, but ngl in NNG these addresses are way more closely affiliated with instances ofnng_pipethan ofnng_socket. the naming confusion is, and I quote, unfortunate. π we don't make the rules bestie, we just read the manpage.
okay so this thing is actually a union, right? it's got different members for different types of addresses. union girlie. she contains multitudes. π
every single one of those member structures has, as its very first element, a uint16_t field holding the address family. that field overlaps with the s_family member of the union, and it's the thing that tells you which specific member you should actually be using. it's like the little name tag at the party π
the values of s_family are, in order:
NNG_AF_UNSPECβ invalid address, no other valid fields. it's giving "no thoughts, head empty." π«₯NNG_AF_INPROCβ address for intraprocess communication (nng_inproc(7)). thes_inprocmember is the valid one. β¨NNG_AF_IPCβ address for interprocess communication (nng_ipc(7)). thes_pathmember is the valid one. πNNG_AF_INETβ address for TCP/IP (v4) communication. thes_inmember is the valid one. π₯NNG_AF_INET6β address for TCP/IP (v6) communication. thes_in6member is the valid one. βNNG_AF_ZTβ address for the ZeroTier transport (nng_zerotier(7)). thes_ztmember is the valid one. πNNG_AF_ABSTRACTβ address for an abstract UNIX domain socket. thes_abstractmember is the valid one. π¦
and like, pls go read the manual pages for each individual type for the full scoop, because this page is just the vibe check, not the whole story. iykyk π«Ά
π SEE ALSO π
nng_sockaddr_abstract(5), nng_sockaddr_in(5), nng_sockaddr_in6(5), nng_sockaddr_inproc(5), nng_sockaddr_ipc(5), nng_sockaddr_zt(5), nng(7)
okay that's the whole page, bestie, you ate that π this was the NNG Reference Manual situation, NNG_SOCKADDR(5), dated 2026-06-30. go forth and address things correctly. mwah πβ¨
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms