1CURLOPT_LOCALPORT(3)                libcurl               CURLOPT_LOCALPORT(3)
2
3
4

NAME

6       CURLOPT_LOCALPORT - local port number to use for socket
7

SYNOPSIS

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

DESCRIPTION

14       Pass a long. This sets the local port number of the socket used for the
15       connection. This can be used in combination  with  CURLOPT_INTERFACE(3)
16       and  you  are recommended to use CURLOPT_LOCALPORTRANGE(3) as well when
17       this option is set. Valid port numbers are 1 - 65535.
18

DEFAULT

20       0, disabled - use whatever the system thinks is fine
21

PROTOCOLS

23       All
24

EXAMPLE

26       CURL *curl = curl_easy_init();
27       if(curl) {
28         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
29         curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
30         /* and try 20 more ports following that */
31         curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
32         ret = curl_easy_perform(curl);
33         curl_easy_cleanup(curl);
34       }
35

AVAILABILITY

37       Added in 7.15.2
38

RETURN VALUE

40       Returns CURLE_OK
41

SEE ALSO

43       CURLOPT_LOCALPORTRANGE(3), CURLOPT_INTERFACE(3),
44
45
46
47ibcurl 8.2.1                    April 26, 2023            CURLOPT_LOCALPORT(3)
Impressum