NNG_STREAM_FREE(3str)

πŸ“¦ version 1.11, in alpine 3.24

✨ 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