NNG_STREAM_RECV(3str)
π NNG_STREAM_RECV β receive from byte stream
okay bestie, welcome to the nng_stream_recv page from the NNG Reference Manual (section 3str, yes we're fancy) π literally the prettiest little async recv you ever did see.
β¨ NAME β¨
nng_stream_recv β receive from byte stream π¦
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
void nng_stream_recv(nng_stream *s, nng_aio *aio);
π DESCRIPTION π
so nng_stream_recv() kicks off an asynchronous receive from the byte stream s, and it drops the bytes into the scatter/gather vector living inside the async I/O structure aio. that's it. that's the whole vibe. β¨
π«Ά bestie pls note: you must have callednng_aio_set_iov()first to set the scatter/gather vector foraio. like, it's not optional. no iov, no slay. π
this function returns immediately with no return value β it's giving "i'm not waiting around" energy. completion is signaled via the aio, and you grab the final result with nng_aio_result(). that result is either zero or an error code. periodt.
the I/O operation completes as soon as at least one byte has been received, or an error has occurred. so lowkey the number of bytes read may be less than requested π β check the actual number of bytes read with nng_aio_count(). icon behaviour, truly.
π₯ RETURN VALUES π₯
None. literally nothing. she gives you nothing back directly and that's the point π
π ERRORS π
NNG_ECANCELEDβ the operation was canceled. someone hit the brakes πNNG_ECLOSEDβ the connection was closed. door's shut bestie πͺNNG_ECONNRESETβ the peer closed the connection. rude, honestly.NNG_ECONNSHUTβ remote peer shutdown after sending data. she said what she said then dipped π¦NNG_EINVALβ theaiodoes not contain a valid scatter/gather vector. yeahβ¦ go callnng_aio_set_iov()first fr frNNG_ENOMEMβ insufficient free memory to perform the operation. no room, no vibes πNNG_ETIMEDOUTβ timeout waiting for data from the connection. the silence was deafening β³
π SEE ALSO π
nng_aio_alloc(3)nng_aio_count(3)nng_aio_result(3)nng_aio_set_iov(3)nng_strerror(3)nng_stream_close(3str)nng_stream_send(3str)nng_stream(5)
and that's the whole page, bestie π«Ά this cutie came straight out of the NNG Reference Manual, dated 2026-01-13, and honestly? she ate. πβ¨ go forth and receive those bytes ππ
π¦ 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