NNG_SOCKADDR_ABSTRACT(5)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’– NNG_SOCKADDR_ABSTRACT(5) πŸ’–

okay bestie, welcome to the NNG Reference Manual corner of the internet, where today we're decoding nng_sockaddr_abstract β€” literally the abstract IPC socket address glow-up ✨


🌸 NAME 🌸

nng_sockaddr_abstract β€” the abstract IPC socket address, but make it a vibe πŸ’…


✨ SYNOPSIS ✨

#include <nng/nng.h>

enum sockaddr_family {
    NNG_AF_ABSTRACT = 6,
};

typedef struct {
    uint16_t sa_family;
    uint16_t sa_len;
    char     sa_name[107];
} nng_sockaddr_abstract;

πŸ¦‹ DESCRIPTION πŸ¦‹

So. An nng_sockaddr_abstract is the specific flavor of nng_sockaddr that represents addresses tied to IPC communication over "abstract" sockets. It's giving niche, it's giving Linux-only, it's giving exactly what you need when you need it 🫢

πŸ’€ Linux only, sorry bestie

Abstract sockets? Only supported on Linux at this point in time. No cap.

Their name is just a plain array of bytes β€” zero special meaning attached, no hidden rules, just bytes being bytes 🌈

Also, and this is the iconically unbothered part:

  • They have no presence in the file system πŸ™ˆ
  • They do not honor any permissions
  • The operating system automatically cleans them up when nobody's using them anymore
⚠️ Note: support for abstract sockets is a new feature in NNG, and it's only available on Linux. Because of that, using them is not recommended for portable applications β€” your code will be sad on other platforms 😭

πŸŽ€ The struct members (the actual tea)

  • sa_family β€” this field always has the value NNG_AF_ABSTRACT. Always. It's loyal like that πŸ’œ
  • sa_len β€” this field provides the length of the name stored in sa_name
  • sa_name β€” this field holds the name of the abstract socket. The bytes of the name can be any value, including zero ⭐
πŸ™ˆ Note: the name does not include the leading NUL byte that Linux uses to tell abstract sockets apart from path name sockets.

πŸ”₯ Auto Bind πŸ”₯

Main character feature alert: you can pass an empty value β€” that's sa_len equal to zero β€” on a listening socket to ask the system to allocate a name for you ✨

On Linux systems, that gets you a name with either 5 or 8 hexadecimal ASCII characters. Cute, right?

Wanna know which name the system picked for you? Just grab the NNG_OPT_LOCADDR option on the listening entity πŸ‘‘

⚠️ Note: since a zero length name is what signals "please auto bind for me", it is impossible to specify an actual empty name. NNG does not support that name, even though the underlying system can support it. And honestly? Using that name is inadvisable anyway πŸ’€

πŸ’– SEE ALSO πŸ’–


that's the whole page bestie, you ate it πŸ“ consider yourself fully briefed on abstract sockets, no notes, periodt πŸ’…

this masterpiece of a manpage is from the NNG Reference Manual, dated 2026-06-30, and it lives under the name NNG_SOCKADDR_ABSTRACT(5) β€” iconic, honestly πŸ‘‘

πŸ“¦ where this page comes from