NNG_IOV(5)

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

πŸ’– NNG_IOV β€” scatter/gather element πŸ¦‹

okay bestie, welcome to the NNG Reference Manual, page NNG_IOV(5) β€” yes it's a section 5 page, it's a struct, and it's giving structured data realness ✨


🌸 NAME 🌸

nng_iov β€” scatter/gather element. that's it, that's the whole name, and honestly? iconic. πŸ’…


✨ SYNOPSIS ✨

#include <nng/nng.h>

typedef struct {
    void * iov_buf;
    size_t iov_len;
} nng_iov;

no cap, that's the whole struct. two fields. she's simple, she's efficient, she's thriving. πŸŽ€


🫢 DESCRIPTION 🫢

so like, an nng_iov structure represents a single element in a scatter/gather array. think of it as one lil' sticky note in a big pile of sticky notes, where each note says "hey, here's a chunk of memory, go get it".

some operations can use arrays of these to access different regions of memory in a single operation. for example β€” and this is the classic slay β€” it may be useful to send a message with header data from one part of memory, and a user payload from another. two memory neighborhoods, one op. no copy, no drama, no extra steps. it's giving zero-copy main character energy fr fr. 🌈

the operations that do this typically store an array of these in an nng_aio structure using the nng_aio_set_iov() function. so that's the pipeline: you build the iovs, the aio holds them, the operation goes brrr. πŸš€


🧚 The Structure Members (yes, both of them, we're not skipping anyone)

  • iov_buf β€” this is a pointer to the first byte within the memory being referenced by this scatter/gather element. like, the starting address. the doorway. the entrance. πŸšͺ✨
  • iov_len β€” this is the size in bytes of this scatter/gather element. how much memory we're talking about, measured in bytes, because that's how we count around here. πŸ“
lowkey important: both of these fields are listed as present in the structure, and they both matter for every iov you ever build. don't skip iov_len, bestie, or the operation won't know where your data ends and that's a whole mess. πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

  • nng_aio_set_iov(3) β€” the function that tucks your iov array into an aio 🫢
  • nng_aio(5) β€” the async i/o structure holding all this together πŸ‘‘
  • nng(7) β€” the big picture, the mothership, the whole vibe ⭐

okay that's the page!! NNG Reference Manual, dated 2026-06-30, filed under NNG_IOV(5). go forth and scatter/gather responsibly, bestie πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from