NNG_STREAM_LISTENER_LISTEN(3str)
π NAME π
okay bestie, welcome to the nng_stream_listener_listen page from the NNG Reference Manual β manual name NNG_STREAM...NER_LISTEN(3str), and she's iconic. The whole assignment is literally bind listener to configured address. No cap. β¨
β¨ SYNOPSIS β¨
#include <nng/nng.h>
int nng_stream_listener_listen(nng_stream_listener *l);
π¦ DESCRIPTION π¦
Okay so nng_stream_listener_listen() attempts to bind the listener l to the local address specified when the listener was created. That's the main character energy of this function. π
This must generally be done before accepting incoming connections using nng_stream_listener_accept(). Like, bind first, then accept β that's the vibe check. π
For some transports this will also perform other actions. For example, with TCP listeners it will configure the underlying port into passive mode, ready to accept an incoming connection, and set up a listen queue for receiving incoming connections. TCP listener said "I'm ready for my close-up." π¬
If binding the listener requires allocation of an address β for example, when a TCP port number of zero is specified, indicating that an ephemeral port should be used β this operation will allocate that resource. This can permit retrieval of the selected address using nng_stream_listener_get(), typically with the NNG_OPT_LOCADDR option. So yes, she can allocate the address resource and later tell you which address got picked. π
π RETURN VALUES π
This function returns 0 on success, and non-zero otherwise. Slay. β¨
π₯ ERRORS π₯
NNG_EADDRINUSEβ the address is already in use. Someone else called dibs, bestie. πNNG_EADDRINVALβ the address is invalid or unavailable. It's giving "invalid address" energy, fr fr. πNNG_ECLOSEDβ the listener has been closed. She's gone, periodt. πNNG_ESTATEβ the listener is already bound. Not me trying to bind twice, lowkey embarrassing. π
π SEE ALSO π
go read these next, iykyk π
xoxo, your Unix bestie π β source/version: NNG Reference Manual; date: 2026-01-13; page: NNG_STREAM...NER_LISTEN(3str). mwah π
π¦ where this page comes from
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms