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

NAME

6       CURLINFO_PRIMARY_PORT - get the latest destination port number
7

SYNOPSIS

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

DESCRIPTION

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

PROTOCOLS

19       All
20

EXAMPLE

22       CURL *curl = curl_easy_init();
23       if(curl) {
24         CURLcode res;
25         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
26         res = curl_easy_perform(curl);
27         if(res == CURLE_OK) {
28           long port;
29           res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
30           if(!res)
31             printf("Connected to remote port: %ld\n", port);
32         }
33         curl_easy_cleanup(curl);
34       }
35

AVAILABILITY

37       Added in 7.21.0
38

RETURN VALUE

40       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
41       if not.
42

SEE ALSO

44       curl_easy_getinfo(3), curl_easy_setopt(3),
45
46
47
48libcurl 7.61.1                   May 06, 2017         CURLINFO_PRIMARY_PORT(3)
Impressum