GNURLOPT_PORT(3)
π
GNURLOPT_PORT(3) β like, the curl_easy_setopt options girlies β¨
okay so real talk, this is from the gnurl manual, section 3 (the curl_easy_setopt options corner of the library), and bestie, it's a short one but it matters. Let's get into it π
πΈ NAME πΈ
CURLOPT_PORT β set the remote port number you wanna work with, no cap π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number);
like, that's the whole vibe. three args, one dream π«Ά
π DESCRIPTION π
So this option sets number to be the remote port number to connect to β instead of the one that's specified in the URL, or the default port for whatever protocol you're using. it's giving "I make the rules now" π
Usually you just let the URL decide which port to use (and honestly? iconic behaviour, she knows what she's doing), but this option lets the application override that. main character energy fr β¨
β οΈ okay important thing though: while this option accepts a long, a port number is usually a 16 bit number, and therefore using a port number over 65535 will cause a run-time error. so likeβ¦ don't do that π
π¦ DEFAULT π¦
By default this is 0, which makes it not used. she's dormant. she's resting. she awakens only when summoned π
π PROTOCOLS π
Used for all protocols that speak to a port number. so basically everyone, bestie π
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
look at her go. 8080L and everything π (note the L β it's a long, she's fancy like that)
β AVAILABILITY β
Always. she's been here since day one, no gatekeeping π
π RETURN VALUE π
Returns CURLE_OK. that's it, that's the tweet π¦
π SEE ALSO π
go read those next, iykyk π§
π and that's the page!! brought to you by libcurl 7.37.0, dated 17 Jun 2014 β yeah she's vintage, she's a classic, she ate and left no crumbs. mwah π π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2014, 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