1CURLINFO_LOCAL_PORT(3)     curl_easy_getinfo options    CURLINFO_LOCAL_PORT(3)
2
3
4

NAME

6       CURLINFO_LOCAL_PORT - get the latest local port number
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_LOCAL_PORT, long *portp);
12

DESCRIPTION

14       Pass  a  pointer to a long to receive the local port number of the most
15       recent connection done with this curl handle.
16

PROTOCOLS

18       All
19

EXAMPLE

21       {
22         CURL *curl;
23         CURLcode res;
24
25         curl = curl_easy_init();
26         if(curl) {
27           curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
28           res = curl_easy_perform(curl);
29
30           if(CURLE_OK == res) {
31             long port;
32             res = curl_easy_getinfo(curl, CURLINFO_LOCAL_PORT, &port);
33
34             if(CURLE_OK == res) {
35               printf("We used local port: %ld\n", port);
36             }
37           }
38           curl_easy_cleanup(curl);
39         }
40         return 0;
41       }
42

AVAILABILITY

44       Added in 7.21.0
45

RETURN VALUE

47       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
48       if not.
49

SEE ALSO

51       curl_easy_getinfo(3),   curl_easy_setopt(3),  CURLINFO_PRIMARY_PORT(3),
52       CURLINFO_LOCAL_IP(3),
53
54
55
56libcurl 7.85.0                   May 17, 2022           CURLINFO_LOCAL_PORT(3)
Impressum