NNG_SOCKET_PAIR(3supp)
π NNG_SOCKET_PAIR (3supp) β from the NNG Reference Manual, bestie β¨
πΈ NAME πΈ
nng_socket_pair β the glow-up that makes you a connected pair of BSD sockets π
π SYNOPSIS π
#include <nng/nng.h>
int nng_socket_pair(int fds[2]);
π¦ DESCRIPTION π¦
okay so picture this: nng_socket_pair() literally creates a pair of connected BSD sockets for you, no cap. They come back to you in the fds array, and β this is the important part β they're suitable for use with the socket transport. slay π
On POSIX platforms this is just a thin wrapper around the standard socketpair() function, using the AF_UNIX family and the SOCK_STREAM socket type. iconic behavior honestly π«Ά
π Note: rn, only POSIX platforms that implement socketpair() are supported with this function. so likeβ¦ vibe check your platform first, okay? π
π‘ Tip: this function is lowkey perfect for creating a shared connection between a parent process and a child process on UNIX platforms β and the way that it does it without requiring a shared filesystem or a TCP connection?? obsessed. π₯
β RETURN VALUES β
This function returns 0 on success, and non-zero otherwise. that's it, that's the whole vibe β¨
π ERRORS π
NNG_ENOMEMβ insufficient memory exists. not enough room bestie, it's giving full closet πNNG_ENOTSUPβ this platform does not support socket pairs. rude of it, honestly π
π SEE ALSO π
go read those, iykyk π
mwah, that's the page β brought to you by the NNG Reference Manual, dated 2026-01-13, and yes the footer still says NNG_SOCKET_PAIR(3supp) bc we keep it accurate around here πβ¨
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms