NN_SOCKET(3compat)
π NN_SOCKET (3compat)
okay so real talk, this is the nn_socket page from the NNG Reference Manual β the legacy-compat corner of the house π β¨
πΈ NAME
nn_socket β create a socket (compatible API). that's it, that's the whole vibe π
β¨ SYNOPSIS
#include <nanomsg/nn.h>
int nn_socket(int af, int proto);
π DESCRIPTION
so nn_socket() literally makes you a socket using the address family af and the protocol proto, then hands it right back to you π«Ά slay.
π¨ note bestie: this function exists purely for API compatibility with legacy libnanomsg. like, consider using the relevant modern API instead, fr fr. it's giving "retro chic" but the modern one is the main character π
β οΈ important, no cap: mixing the compatibility API and the modern API is not supported on a given socket. pick a lane, bestie π
π also note: some protocols, transports, and features are only available in the modern API. so if something's missing, that's why π
the address family af can be one of two values:
AF_SPβ normal socket πAF_SP_RAWβ raw mode socket π₯
the protocol tells you which protocol to use when creating the socket. the following protocols are defined:
NN_PAIRβ Pair protocol π§NN_PUBβ Publisher protocol π’NN_SUBβ Subscriber protocol πNN_REQβ Requestor protocol πNN_REPβ Replier protocol π¬NN_PUSHβ Push protocol β‘οΈNN_PULLβ Pull protocol β¬ οΈNN_SURVEYORβ Surveyor protocol πNN_RESPONDENTβ Respondent protocol π£οΈNN_BUSβ Bus protocol π
π RETURN VALUES
this function returns a valid socket number on success π, and -1 on failure π.
π₯ ERRORS
ENOMEMβ insufficient memory is available. the vibes are out of RAM πENOTSUPβ the protocol is not supported. nope, not that one πETERMβ the library is shutting down. it's logging off, respectfully π«‘
π¦ SEE ALSO
nng_socket(5), nn_close(3compat), nn_errno(3compat), nng_compat(3compat), nng(7)
and that's the whole page, bestie π go forth and socket responsibly β¨
π source/version: the NNG Reference Manual β page NN_SOCKET(3compat) β dated 2026-01-13. iykyk π
π¦ 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