NNG_SOCKET_PROTO_ID(3)
β¨ NAME β¨
nng_socket_proto_id β bestie, this is how you get the socket's protocol id π (yes there's a twin function too, keep reading)
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
int nng_socket_proto_id(nng_socket s, uint16_t *id);
int nng_socket_peer_id(nng_socket s, uint16_t *id);
π DESCRIPTION π
okay so these two functions are literally the duo of the century π«Ά they take a socket s and drop its 16-bit protocol identifier right into *id. no cap, that's the whole vibe.
nng_socket_proto_idβ gives you the protocol id of the socketsitself πnng_socket_peer_idβ gives you the protocol id of its natural peer π¦ (iykyk)
Tip π‘ β for any new code you write, use these functions instead of theNNG_OPT_PROTOandNNG_OPT_PEERoptions. the old way is giving "still works but not the moment anymore", so switch, bestie. slay.
π₯ RETURN VALUES π₯
they return zero on success β¨ β or an error if the socket is invalid π (rude of it, honestly, but okay).
π ERRORS π
NNG_ECLOSEDβ the parametersdoes not refer to an open socket. it's giving ghosted π«₯ not a single open socket in sight.
π SEE ALSO π
k that's the whole page, no notes π this came straight out of the NNG Reference Manual, dated 2026-06-30, and it'sNNG_SOCKET_PROTO_ID(3) to its friends. go read your sockets, bestie β periodt π
π¦ 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