NNG_LISTENER(5)
π NNG_LISTENER(5) π
okay so bestie, welcome to the nng_listener page from the NNG Reference Manual β¨ grab a snack, this one's short but it's lowkey foundational π«Ά
β¨ NAME β¨
nng_listener β listener π (yes that's the whole name, she's simple and she's iconic)
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
typedef struct nng_listener_s nng_listener;
that's it. that's the whole thing. a typedef and a dream π
π¦ DESCRIPTION π¦
so an nng_listener is a handle to a listener object, and its whole job β her entire purpose, her main character arc β is creating nng_pipe objects by accepting incoming connections. π
and like, not just one pipe. one single listener object can spin up many pipes at the same time, no cap. think of it like an HTTP server that's got a whole crowd of connections to a bunch of different clients all at once. she's popular, she's booked, she's thriving π
listener objects get created by nng_listener_create() or nng_listen(), and they're always associated with a single nng_socket. one socket, one listener-buddy (well, per listener anyway, iykyk).
β οΈ Important β the nng_listener structure is always passed by value, both for input parameters and return values, and you should treat it as opaque. passing structs around like this is actually a glow-up because it gives the compiler a chance to do accurate type checks in functions that pass values of this type. so like, don't go poking at her insides, let the compiler do the vibes check π₯
π‘ Tip β a given nng_socket can have multiple listener objects, multiple dialer objects, or even some of both. mix and match, she contains multitudes β¨
π‘ Tip β the client/server relationship that dialer/listener describes is completely orthogonal to any similar relationship in the protocols. like fr fr, arepsocket may use a dialer to connect to a listener on anreqsocket. this orthogonality is genuinely a slay because it can lead to innovative solutions to otherwise challenging communications problems. not me being obsessed with this design π
listener objects may be destroyed by the nng_listener_close() function. they also get closed when their associated socket is closed β they're ride or die like that π₯Ί
π Initialization π
a listener may be initialized using the macro NNG_LISTENER_INITIALIZER before it is opened, so you don't confuse it with a valid open listener. do this. seriously. it's the self-care step π
π SEE ALSO π
nng_listen(3)nng_listener_close(3)nng_listener_create(3)nng_listener_getopt(3)nng_listener_id(3)nng_listener_setopt(3)nng_listener_start(3)nng_dialer(5)nng_pipe(5)nng_socket(5)nng(7)
okay that's the whole page bestie, you ate it, go forth and accept some connections π«Άβ¨
this was the NNG Reference Manual version dated 2026-06-30, page NNG_LISTENER(5) β k byeeee ππ§π
π¦ 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