NNG_HTTP_CONN_READ_ALL(3http)

πŸ“¦ version 1.11, in alpine 3.24

πŸ’… NNG_HTTP_CONN_READ_ALL(3http)

okay so bestie, welcome to the nng_http_conn_read_all page from the NNG Reference Manual ✨ this one is short and sweet and honestly kind of a vibe.


πŸ¦‹ NAME

nng_http_conn_read_all β€” read all the things from an HTTP connection 🫢 (yes, all of them, that's literally the whole point)


🌸 SYNOPSIS

#include <nng/nng.h>
#include <nng/supplemental/http/http.h>

void nng_http_conn_read_all(nng_http_conn *conn, nng_aio *aio);

πŸŽ€ DESCRIPTION

so nng_http_conn_read_all() kicks off an asynchronous read from the HTTP connection conn, and it drops the data into the scatter/gather vector that's chillin' inside the asynchronous I/O structure aio. it's giving "grab everything, no crumbs left" πŸ’…

⭐ note, bestie: you must have called nng_aio_set_iov() first to set the scatter/gather vector for aio. like, that's not optional, that's the whole setup. no iov, no read. periodt.

this function returns immediately with no return value β€” it's asynchronous, she doesn't wait around πŸ™ˆ completion of the operation gets signaled via the aio, and the final result is available through nng_aio_result(). that result will either be zero or an error code. that's it, that's the deal.

the I/O operation completes only when the entire amount of data requested has been read, or an error has occurred. if it completes successfully, then the entire requested data has been read. no half-measures, we love that for us πŸ‘‘

ngl though, it's still possible for a partial read to complete in the event of an error. the actual number of bytes read can be determined with nng_aio_count(). so like, always check your count, iykyk πŸ’–

🌈 tip: the main purpose for this function is to facilitate reading HTTP body content, after first determining the length of the body content from the relevant HTTP headers (typically Content-Length). so: headers first, then this function eats. iconic behavior fr fr.

πŸ“ RETURN VALUES

None. she returns nothing, she just does 😌


πŸ”₯ ERRORS

here's the whole mood board of things that can go wrong πŸ’€

  • NNG_ECANCELED β€” the operation was canceled. rude, but okay.
  • NNG_ECLOSED β€” the connection was closed. she's gone, bestie 😭
  • NNG_ECONNRESET β€” the peer closed the connection. not them ghosting you mid-read πŸ™ˆ
  • NNG_EINVAL β€” the aio does not contain a valid scatter/gather vector. did you even call nng_aio_set_iov()?? πŸ‘€
  • NNG_ENOMEM β€” insufficient free memory to perform the operation. your RAM said "no πŸ’…"
  • NNG_ENOTSUP β€” HTTP operations are not supported. wrong build, bestie.
  • NNG_ETIMEDOUT β€” timeout waiting for data from the connection. the connection is taking forever and honestly? same.

🧚 SEE ALSO

go get you some related lore:


okay that's the whole page, you ate that 🫢 this has been the NNG Reference Manual, dated 2026-01-13, for NNG_HTTP_CONN_READ_ALL(3http) β€” go read some HTTP bodies, queen πŸ‘‘βœ¨

πŸ“¦ where this page comes from