NNG_STREA...ENER_ALLOC(3str)
π NAME π
nng_stream_listener_alloc β the glow-up that allocates a byte stream listener β¨
okay so real quick bestie, this whole page lives in the NNG Reference Manual (nng fam, you already know), and it's literally just about making a listener. that's it. that's the vibe π
β¨ SYNOPSIS β¨
#include <nng/nng.h>
int nng_stream_listener_alloc(nng_stream_listener **lp, const char *addr);
int nng_stream_listener_alloc_url(nng_stream_listener **lp, const nng_url *url);
two flavors, same energy π«Ά
πΈ DESCRIPTION πΈ
okay so these functions allocate a listener for byte streams, periodt. and what does a listener do? it makes nng_stream objects by accepting incoming connections through the nng_stream_listener_accept() function. that's the whole main character job description π
the first form, nng_stream_listener_alloc(), connects to the address specified by addr β which should be a string representing a URL. yes, a string. put the URL in the string. iykyk π
the second form, nng_stream_listener_alloc_url(), takes a pre-parsed or pre-constructed nng_url object to determine the remote address. so if you already did the parsing homework, this one's for you π§
these functions may support different URL schemes, such as ipc://, tcp://, tls+tcp://, or ws://. so many options, so little time π₯
and the important bit β both forms store the listener in the location referenced by lp. both of them. no exceptions. don't lose that pointer, bestie π
β RETURN VALUES β
these functions return 0 on success, and non-zero otherwise. that's it. 0 = slay, non-zero = check the errors section below π
π ERRORS π
NNG_ENOMEMβ insufficient free memory exists. the vibe check failed, there's just not enough RAM to go around πNNG_ENOTSUPβ the URL scheme is not supported by the implementation. you asked for a scheme this build simply cannot serve, no cap πNNG_EADDRINVALβ the URL requested is invalid. the URL is giving nothing, it's not valid π
π¦ SEE ALSO π¦
nng_strerror(3)nng_stream_listener_accept(3str)nng_stream_listener_close(3str)nng_stream_listener_free(3str)nng_stream_listener_get(3str)nng_stream_listener_listen(3str)nng_stream_listener_set(3str)nng_stream_listener(5)
go read those next, bestie, the whole saga is right there πβ¨
and that's the page!! π this iconic little drop is from the NNG Reference Manual, dated 2026-01-13, filed under NNG_STREA...ENER_ALLOC(3str) β mwah, go allocate something gorgeous ππ
π¦ 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