1CURLOPT_PORT(3)            curl_easy_setopt options            CURLOPT_PORT(3)
2
3
4

NAME

6       CURLOPT_PORT - set remote port number to work with
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number);
12

DESCRIPTION

14       This option sets number to be the remote port number to connect to, in‐
15       stead of the one specified in the URL or the default port for the  used
16       protocol.
17
18       Usually,  you just let the URL decide which port to use but this allows
19       the application to override that.
20
21       While this option accepts a 'long', a port number is usually a  16  bit
22       number  and  therefore using a port number over 65535 will cause a run-
23       time error.
24

DEFAULT

26       By default this is 0 which makes it not used.
27

PROTOCOLS

29       Used for all protocols that speak to a port number.
30

EXAMPLE

32       CURL *curl = curl_easy_init();
33       if(curl) {
34         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
35         curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
36         ret = curl_easy_perform(curl);
37         curl_easy_cleanup(curl);
38       }
39

AVAILABILITY

41       Always
42

RETURN VALUE

44       Returns CURLE_OK
45

SEE ALSO

47       CURLOPT_STDERR(3), CURLOPT_DEBUGFUNCTION(3),
48
49
50
51libcurl 7.76.1                 November 04, 2020               CURLOPT_PORT(3)
Impressum