GNURLINFO_NUM_CONNECTS(3)
πΈ NAME πΈ
Hey bestie π this is GNURLINFO_NUM_CONNECTS(3), straight from the curl_easy_getinfo options manual β and it's all about get number of created connections β¨
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NUM_CONNECTS, long
*nump);
π DESCRIPTION π
Okay so you pass in a pointer to a long, and it receives how many brand-new connections libcurl had to create to pull off the previous transfer β and no cap, only the successful connects are counted π
Team it up with CURLINFO_REDIRECT_COUNT(3) and you can figure out how many times libcurl successfully reused existing connection(s) or didn't π Check the connection options in curl_easy_setopt(3) to see how libcurl tries to make persistent connections and save time β iconic behavior, honestly β
bestie, the βonly successful connectsβ thing is the whole vibe check here π
π PROTOCOLS π
All β every protocol, periodt π
π EXAMPLE π
Here's the exact example, untouched and serving main-character energy:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long connects;
res = curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &connects);
if(res)
printf("It needed %d connects\n", connects);
}
curl_easy_cleanup(curl);
}
π¦ AVAILABILITY π¦
Added in 7.12.3 β vintage but still iconic π
π₯ RETURN VALUE π₯
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that, bestie π
π«Ά SEE ALSO π«Ά
curl_easy_getinfo(3), curl_easy_setopt(3), β go read those too, iykyk π
Signed off with libcurl 7.44.0 energy, dated 12 Sep 2015 β mwah π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms