NNG_HTTP_CONN_WRITE_REQ(3http)
π nng_http_conn_write_req β write HTTP request π
okay bestie, so this is a page from the NNG Reference Manual, and it's all about yeeting an HTTP request out the door asynchronously. buckle up π
β¨ NAME β¨
nng_http_conn_write_req β write HTTP request. that's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
void nng_http_conn_write_req(nng_http_conn *conn, nng_http_req *req,
nng_aio *aio);
like, copy-paste it exactly, don't @ me π
β¨ DESCRIPTION β¨
so nng_http_conn_write_req() starts an asynchronous write of the HTTP request req to the connection conn. π¦
and it doesn't do half the job β the entire request gets sent. that means the headers, and if there's request body data present, that too, no cap. (also FYI, that request body can be set with nng_http_req_set_data() or nng_http_req_copy_data() β drop those in beforehand and you're golden β¨)
this function returns immediately, with no return value. like, it literally gives you nothing back at the call site. instead, completion of the operation is signaled via the aio, and the final result may be obtained via nng_aio_result(). and that result will either be zero or an error code β that's the whole range, bestie, simple as π«Ά
π‘ Note β consider using thenng_http_client_transact()ornng_http_conn_transact()functions instead, which provide a simpler interface for performing a complete HTTP client transaction. lowkey they're the main character here, this function is more of a supporting role ngl π
β¨ RETURN VALUES β¨
None. literally nothing. it's a void function, she returns nothing and she's iconic for it π
β¨ ERRORS β¨
here's the guest list of error codes that can show up in your nng_aio_result() π
NNG_ECANCELEDβ the operation was canceled. someone pulled the plug.NNG_ECLOSEDβ the connection was closed. rip.NNG_ECONNRESETβ the peer closed the connection. like they just hung up mid-convo, rude πNNG_ENOMEMβ insufficient free memory to perform the operation. your RAM said "no β€οΈ"NNG_ENOTSUPβ HTTP operations are not supported. this build said "not my vibe" πNNG_ETIMEDOUTβ timeout waiting for data from the connection. she waited, she got nothing, she left. β°
β¨ SEE ALSO β¨
go read these next, they're all linked and gorgeous πΈ
nng_aio_alloc(3)nng_aio_result(3)nng_http_client_connect(3http)nng_http_client_transact(3http)nng_http_conn_read_all(3http)nng_http_conn_transact(3http)nng_strerror(3)nng(7)
and that's the whole page, bestie!! π this lil beauty is from the NNG Reference Manual, dated 2026-01-13 β so she's fresh, she's current, she's serving documentation realness. mwah πβ¨π
π¦ 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