GNURLINFO_PRIMARY_PORT(3)
π NAME π
okay so this page is GNURLINFO_PRIMARY_PORT(3), from the curl_easy_getinfo options crew, and it's literally about CURLINFO_PRIMARY_PORT β get the latest destination port number. slay.
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRIMARY_PORT, long
*portp);
πΈ DESCRIPTION πΈ
Pass a pointer to a long to receive the destination port of the most recent connection done with this curl handle. that's the whole vibe, bestie π
π¦ PROTOCOLS π¦
All β every protocol, no cap.
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
long port;
res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
if(!res)
printf("Connected to remote port: %ld\n", port);
}
curl_easy_cleanup(curl);
}
π AVAILABILITY π
Added in 7.21.0 β¨
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. fr fr, that's the check.
π«Ά SEE ALSO π«Ά
okay bye bestie, this was libcurl 7.44.0 from 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