NNG_CTX_CLOSE(3)
nng_ctx_close(3) β the NNG Reference Manual page where we say bye-bye to a context π
okay bestie, gather round, because today we're learning how to close a context in NNG and honestly it's giving closure (literally) π
β¨ NAME β¨
nng_ctx_close β close context π«Ά
β¨ SYNOPSIS β¨
#include <nng/nng.h>
int nng_ctx_close(nng_ctx ctx);
like, that's it. one function, one argument, iconic behavior π
β¨ DESCRIPTION β¨
so nng_ctx_close() closes the context ctx. that's the whole vibe. π
but wait β plot twist β messages that have already been submitted for sending may be flushed or delivered, and whether that happens depends on the transport. so no, this isn't a "cancel everything instantly" button, it's more of a "we're wrapping up here" moment. no cap. π
after this call returns, if you try to use that context again? boom, you get NNG_ECLOSED. every time. it's over, babe. π
and threads that were waiting on operations on the context at the moment this call runs may also come back with an NNG_ECLOSED result. so yeah, everyone's getting the news at the same time. group chat announcement energy fr fr π£
Note π«§ closing the socket that's associated withctx(as in, usingnng_close()) also closes this context. so the context goes down with the ship. π
β¨ RETURN VALUES β¨
0on success β slay π- non-zero otherwise β not slay π
β¨ ERRORS β¨
NNG_ECLOSEDβ the contextctxis already closed or was never opened in the first place. she's gone, or she never existed. either way, nothing to close here bestie π¦
β¨ SEE ALSO β¨
and that's the page!! this was the NNG Reference Manual, dated 2026-06-30, and honestly? obsessed. go close your contexts responsibly, besties πβ¨
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms