CURLMOPT_NETWORK_CHANGED(3)
π CURLMOPT_NETWORK_CHANGED(3) β like, the libcurl manual, bestie
okay so this is a page from the Library Functions Manual and it's literally just called CURLMOPT_NETWORK_CHANGED, and it's about telling libcurl "hey girl, the network changed" π¦ stay with me, it's actually so good.
β¨ NAME β¨
CURLMOPT_NETWORK_CHANGED β signal network changed π«
π SYNOPSIS π
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_NETWORK_CHANGED,
long value);
π DESCRIPTION π
So you pass a long in there that's a bitmask, and it tells the multi handle how it should react. Here's the thing though β only the values listed below are defined in that mask. Every other bit? Reserved for future extensions, no cap. π
Now this is the iconic part: this option can be set at any time and repeatedly. Each call only affects the connections and DNS info that are currently cached. Any connection created, or DNS info added, afterwards gets cached the usual way again. Phrasing it another way (because yes, the manpage says it twice, and honestly? valid): the option is not persisted β setting it is basically a "trigger" to clear the caches. π§
Also super important: the call affects only the connection and DNS cache of the multi handle itself, and not the ones owned by SHARE handles. Boundaries, bestie. π
CURLMNWC_CLEAR_ALLβ Clear everything. Like, everything everything. (Added in 8.20.0) π₯CURLMNWC_CLEAR_CONNSβ No longer reuse any existing connection in the multi handle's connection cache. This closes all connections that are not in use. Ongoing transfers continue on the connections they operate on. So nobody gets yanked mid-transfer, we're not monsters. π«ΆCURLMNWC_CLEAR_DNSβ Clear the multi handle's DNS cache. Ongoing transfers keep using their already resolved addresses, but future name resolutions are performed again. Fresh start energy β¨
πΈ DEFAULT πΈ
0, which has no effect. Nothing happens. A whole lot of nothing. π
π PROTOCOLS π
This functionality affects all supported protocols. All of them. Every single one. periodt. π
β EXAMPLE β
int main(void)
{
CURLM *m = curl_multi_init();
/* do transfers on the multi handle */
/* do not reuse existing connections */
curl_multi_setopt(m, CURLMOPT_NETWORK_CHANGED, CURLMNWC_CLEAR_CONNS);
}
look at her go π doing transfers, then deciding nope, no more reusing connections. main character energy fr fr.
π¦ AVAILABILITY π¦
Added in curl 8.16.0. If your curl is older than that, this option simply does not exist for you, iykyk. π₯²
π RETURN VALUE π
curl_multi_setopt(3) returns a CURLMcode indicating success or error.
CURLM_OK (0) means everything was OK. Non-zero means an error occurred β see libcurl-errors(3). π
π SEE ALSO π
k that's the whole page, you ate that π«Ά this was libcurl, dated 2026-10-25, filed under CURLMOPT_NETWORK_CHANGED(3) β mwah, go clear some caches bestie π
π
π¦ where this page comes from
- alpine 3.23: curl-doc 8.23.0-r0 Β· curl
- alpine 3.24: curl-doc 8.23.0-r0 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms