NNG_STREAM_RECV(3str)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… 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 called nng_aio_set_iov() first to set the scatter/gather vector for aio. 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 β€” the aio does not contain a valid scatter/gather vector. yeah… go call nng_aio_set_iov() first fr fr
  • NNG_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 🌈


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