NNG_HTTP_SERVER_HOLD(3http)
π NAME π
nng_http_server_hold β get and hold HTTP server instance. This is the NNG_HTTP_SERVER_HOLD(3http) page from the NNG Reference Manual, and yes bestie, we are literally about to hold an HTTP server. π«Ά
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/http/http.h>
int nng_http_server_hold(nng_http_server **serverp, const nng_url *url);
πΈ DESCRIPTION πΈ
Okay so nng_http_server_hold() acquires an instance of an HTTP server suitable for use in serving the URL identified by url, and stores a pointer to it at the location pointed to by serverp. Slay. π
Here's the little sequence it runs through: it first looks to see if an existing HTTP server instance exists that is suitable for this. If so, it increments the reference count on it and uses that. Otherwise, it will attempt to create a new server instance with an initial reference count of one (1). Periodt.
The server instance is not started β and it can have additional configuration applied to it before it is later started with nng_http_server_start(). So you get to dress it up first. π
Note β The URL matching logic in determining servers is unable to distinguish between different aliases for the same local IP address. This may create problems when using URLs for virtual hosting. It is recommended to use canonical IP addresses or names in the url to avoid confusion. π
β RETURN VALUES β
This function returns 0 on success, and non-zero otherwise. That's the vibe check, fr fr. β¨
π₯ ERRORS π₯
NNG_ENOMEMβ insufficient free memory exists. πNNG_ENOTSUPβ HTTP not supported. π
π¦ SEE ALSO π¦
nng_http_server_add_handler(3http)nng_http_server_release(3http)nng_http_server_stop(3http)nng_url_parse(3)nng_strerror(3)nng(7)
Catch you later, bestie β this one is from the NNG Reference Manual, dated 2026-01-13. Stay iconic. πβ¨
π¦ 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