NNG_AIO_COUNT(3)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’– 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 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