NNG_STREAM_LISTENER_SET(3str)
π nng_stream_listener_set β set option on byte stream listener π
okay bestie, welcome to the NNG_STREAM_LISTENER_SET(3str) page from the NNG Reference Manual. this is the one where we set options on a byte stream listener, and itβs lowkey a whole family of functions. letβs get into it π
β¨ NAME β¨
nng_stream_listener_set β set option on byte stream listener. thatβs the main-character mission, fr fr π
π¦ SYNOPSIS π¦
#include <nng/nng.h>
int nng_stream_listener_set(nng_stream_listener *l, const char *name, const void *data, size_t size);
int nng_stream_listener_set_bool(nng_stream_listener *l, const char *opt, bool val);
int nng_stream_listener_set_int(nng_stream_listener *l, const char *opt, int val);
int nng_stream_listener_set_ms(nng_stream_listener *l, const char *opt, nng_duration val);
int nng_stream_listener_set_ptr(nng_stream_listener *l, const char *opt, void *val);
int nng_stream_listener_set_size(nng_stream_listener *l, const char *opt, size_t val);
int nng_stream_listener_set_string(nng_stream_listener *l, const char *opt, const char *val);
int nng_stream_listener_set_uint64(nng_stream_listener *l, const char *opt, uint64_t val);
int nng_stream_listener_set_addr(nng_stream_listener *l, const char *opt, const nng_sockaddr *val);
π DESCRIPTION π
so the nng_stream_listener_set() functions are how you configure options for the byte stream listener l. which options can you set? it varies, bestie β the actual option is named by opt. a bunch of them are documented over in nng_options(5).
also, some transport-specific and protocol-specific options are documented with the transports and protocols themselves. so if youβre looking for the tea on a particular option, check that optionβs own docs, iykyk πΈ
π Forms π
the type, the size, and the semantics of an option all depend on the actual option, and theyβre documented with the option itself. so the option is basically the main character here π
nng_stream_listener_set()β this one is untyped, and it can configure any arbitrary data.valpoints at the data to copy, andsizeis the size of the object located atval.
Note: this function is deprecated. use one of the typed forms instead, bestie π
nng_stream_listener_set_bool()β for options that take a Boolean (bool). cute and simple πnng_stream_listener_set_int()β for options that take an integer (int). classic πnng_stream_listener_set_ms()β configures time durations (like timeouts) using the typenng_duration. the duration is an integer number of milliseconds. yes, milliseconds, write it down β¨nng_stream_listener_set_ptr()β passes a pointer to structured data. the data referenced by it is generally managed by other functions. for example, TLS configuration objects created withnng_tls_config_alloc()can be passed this way.
Note: this form is somewhat special: the object is generally <strong>not</strong> copied, but instead the pointer to the object is copied. please see the documentation for the specific option for further details, okay? π«Ά
nng_stream_listener_set_size()β configures a size, typically for buffer sizes, message maximum sizes, and similar options. very size, very demure πΈnng_stream_listener_set_string()β configures a string. strings passed this way must be legal UTF-8 or ASCII strings, terminated with aNUL(\0) byte. other constraints may apply too, so see the documentation for each option for details π¦nng_stream_listener_set_uint64()β configures a 64-bit unsigned value. this is typically used for identifiers, network numbers, and similar options. big number energy π₯nng_stream_listener_set_addr()β configures a socket address. the value is copied, so the caller may discard the supplied value immediately after this function returns. no need to cling to it, bestie π
β RETURN VALUES β
this function returns 0 on success, and non-zero otherwise. thatβs the whole vibe check β
π¨ ERRORS π¨
NNG_ECLOSEDβ the listener is closed. sheβs not available rn πNNG_EINVALβ eitherdataorsizeare invalid. check those, bestie πNNG_ENOTSUPβ the option is not supported. not every option is invited to the party πNNG_EREADONLYβ the option may not be modified. read-only means read-only, periodt π
π SEE ALSO π
nng_strerror(3)nng_stream_listener_get(3str)nng_options(5)nng_ipc_options(5)nng_tcp_options(5)nng_tls_options(5)nng_stream_listener(5)
mwah π
this has been the NNG_STREAM_LISTENER_SET(3str) page from the NNG Reference Manual, dated 2026-01-13. go forth and set those options, bestie π«Άβ¨
π¦ 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