NNG_AIO_COUNT(3)
π nng_aio_count β bestie, how many bytes did we actually move?
okay so real talk, this one is from the NNG Reference Manual, section 3, and it's genuinely one of the cutest little functions in the whole library. it does one thing. it tells you a number. that's it. that's the girl. β¨
β¨ NAME β¨
nng_aio_count β return number of bytes transferred
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
size_t nng_aio_count(nng_aio *aio);
π¦ DESCRIPTION π¦
so nng_aio_count() hands you back the number of bytes transferred by the asynchronous operation that's attached to the handle aio. that's the whole vibe. no cap.
now, some async operations just don't have meaningful data for this, and that's not a bug, that's just how they are. like, operations that establish connections don't transfer user data β they may transfer protocol data though, bestie, so don't come for them β and in that case this function will generally return zero. π it's giving "nothing to see here."
where this function really pops off is with operations that use a scatter/gather vector β y'know, the one you set with nng_aio_set_iov(). that's the moment. that's the main character arc. π
β οΈ NOTE, and this part MATTERS: the return value from this function is undefined if the operation hasn't completed yet. so either call it from the handle's completion callback, or wait for the operation to finish first with nng_aio_wait(). do NOT just yolo it early, i'm begging you. π
π RETURN VALUES π
the number of bytes transferred by the operation. slay.
π ERRORS π
None. not a single one. she simply does not miss. β¨
π SEE ALSO π
nng_aio_alloc(3)nng_aio_result(3)nng_aio_set_iov(3)nng_aio_wait(3)nng_strerror(3)nng_aio(5)nng(7)
NNG Reference Manual Β· 2026-06-30 Β· NNG_AIO_COUNT(3)
k that's the whole page bestie, go forth and count your bytes responsibly, ily π«Άπ
π¦ 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