NNG_SOCKET_PROTO_NAME(3)

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

✨ NNG_SOCKET_PROTO_NAME ✨

okay bestie, gather round, because we're talking about nng_socket_proto_name(3) from the NNG Reference Manual πŸ’œ β€” it's short, it's sweet, and it's lowkey one of the most useful little utilities in the whole library, no cap.


🌸 NAME 🌸

nng_socket_proto_name β€” obtain the socket protocol name πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <nng/nng.h>

int nng_socket_proto_name(nng_socket s, const char **name);
int nng_socket_peer_name(nng_socket s, const char **name);

πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea β˜• β€” these two functions go and store the protocol name of either the socket s, or its natural peer, right into name. that's it. that's the whole job. main character energy, honestly. ✨

πŸ“Œ Note β€” the string value you get back from these functions is statically stored as part of the program text. so like… do NOT free it and do NOT modify it, bestie 😭 it's not yours to touch, it lives there now, it's iconic, leave it be. πŸ™ˆ
πŸ’‘ Tip β€” in new code, you should be using these functions instead of the NNG_OPT_PROTONAME and NNG_OPT_PEERNAME options. like, the options are still there, but this is the moment. the glow-up. use the functions. 🫢

⭐ RETURN VALUES ⭐

they return zero on success πŸŽ‰ β€” or an error if the socket is invalid, which is giving "we don't know her" πŸ’€


πŸ’€ ERRORS πŸ’€

  • NNG_ECLOSED β€” parameter s does not refer to an open socket. so either you closed it, or it was never real to begin with 🫠

🌈 SEE ALSO 🌈


and that's the whole page, bestie! πŸŽ€ this was the NNG Reference Manual edition of NNG_SOCKET_PROTO_NAME(3), dated 2026-06-30 ⭐ go forth and get those protocol names, you absolute icon πŸ‘‘πŸ’–

πŸ“¦ where this page comes from