NNG_SOCKET_PROTO_ID(3)

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

✨ 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 socket s itself πŸ‘‘
  • 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 the NNG_OPT_PROTO and NNG_OPT_PEER options. 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 parameter s does 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