NNG_STREAM_FREE(3str)
β¨ nng_stream_free(3str) β free byte stream β¨
okay bestie, gather round, because this is the nng_stream_free page from the NNG Reference Manual and it's honestly a short one but it's IMPORTANT π
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
void nng_stream_free(nng_stream *s);
like, that's it. that's the whole call. no return value, no drama π
π DESCRIPTION π
so nng_stream_free() does two things and it does them together: it closes the byte stream s, and it frees the underlying resources associated with it. boom. cleanup arc. main character behavior fr fr β¨
and if you had any operations still pending on that stream β think nng_stream_send() or nng_stream_recv() β they get terminated with an NNG_ECLOSED error condition. not me ghosting your pending recv ππ
β οΈ Warning β okay this part is serious, so listen up: it is important that the application ensure that no further accesses are made to s, because the memory backing it will be reclaimed for other uses. like, it's gone gone. don't touch it. don't look at it. don't think about it too hard. π«Ά
π Note β also, closing the connection while data is in transmission will likely lead to loss of that data. there is no automatic linger or flush to ensure that the socket send buffers have completely transmitted. so if you were mid-send and you just free it... yeah. that data said bye π the vibe check did not pass π
β RETURN VALUES β
None. literally nothing. it returns void and it means it π§
π ERRORS π
None. no error codes, no surprises, no "oops" β she's not like other functions π
π SEE ALSO π
okay that's the whole page, bestie, go forth and free your streams responsibly π¦ and remember: this was the NNG Reference Manual, dated 2026-01-13 β slay, stay safe, and don't use memory after you free it π β¨π
π¦ 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