NNG_SOCKET_PROTO_NAME(3)
β¨ 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 theNNG_OPT_PROTONAMEandNNG_OPT_PEERNAMEoptions. 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β parametersdoes 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
- 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