NNG_LISTENER_CREATE(3)
π NAME π
okay so bestie, nng_listener_create β it makes you a listener β¨ that's the whole vibe
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
int nng_listener_create(nng_listener *listenerp, nng_socket s, const char *url);
π DESCRIPTION π
so nng_listener_create() literally hands you a brand new, freshly initialized nng_listener object π¦ β it's tied to the socket s, it's all set up to listen at the address you gave it in url, and it drops a pointer to that listener right where listenerp points. periodt.
what are listeners for, you ask? π they accept connections that remote dialers start. when a connection comes in, that generally means a pipe gets created and attached to socket s. and here's the iconic part: unlike dialers, listeners can generally make, like, so many pipes β and they can all be open at the same time. main character energy fr fr π
β¨ tip β¨ it's comfy to think of listeners as "the servers", but ngl β the listener/dialer thing is orthogonal to whatever server-or-client status a given protocol has. like, a req socket might have dialers, but it might also have listeners. it could even have some of each at the same time π
the vibes are flexible, iykyk.
so the listener is not started yet β not even a little. but you can keep configuring it with the nng_listener_setopt() family of functions π«Ά
once it's fully configured and cute, you start it with nng_listener_start(). π
π tip β if you don't need any specific configuration at all, maybe just use the simpler nng_listen() function instead? it's giving low-effort, high-reward π
β RETURN VALUES β
0β slay, success π- non-zero β not slay, something went wrong π
π ERRORS π
NNG_EADDRINVALβ theurlyou gave was invalid. not it. πNNG_ECLOSEDβ socketsis not open. bestie she's closed πNNG_ENOMEMβ not enough memory available. the brain cell is empty π
π¦ SEE ALSO π¦
nng_dialer_create(3)nng_listen(3)nng_listener_close(3)nng_listener_getopt(3)nng_listener_setopt(3)nng_listener_start(3)nng_strerror(3)nng_listener(5)nng(7)
and that's the whole page, bestie π this was the NNG_LISTENER_CREATE(3) page from the NNG Reference Manual, dated 2026-06-30 β go build something iconic with it β¨π
π
π¦ 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