NNG_HTTP_CONN_READ_ALL(3http)
π 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 callednng_aio_set_iov()first to set the scatter/gather vector foraio. 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β theaiodoes not contain a valid scatter/gather vector. did you even callnng_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:
nng_aio_alloc(3)nng_aio_count(3)nng_aio_result(3)nng_aio_set_iov(3)nng_strerror(3)nng_http_client_connect(3)nng_http_conn_read(3)nng(7)
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
- alpine 3.24: nng-doc 1.11-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms