quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_PORT.md (1644B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PORT
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_PRIMARY_PORT (3)
      9   - CURLOPT_STDERR (3)
     10   - CURLOPT_URL (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_PORT - remote port number to connect to
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 We discourage using this option since its scope is not obvious and hard to
     31 predict. Set the preferred port number in the URL instead.
     32 
     33 This option sets *number* to be the remote port number to connect to,
     34 instead of the one specified in the URL or the default port for the used
     35 protocol.
     36 
     37 Usually, you just let the URL decide which port to use but this allows the
     38 application to override that.
     39 
     40 While this option accepts a 'long', a port number is an unsigned 16 bit number
     41 and therefore using a port number lower than zero or over 65535 causes a
     42 **CURLE_BAD_FUNCTION_ARGUMENT** error.
     43 
     44 # DEFAULT
     45 
     46 0 which makes it not used. This also makes port number zero impossible to set
     47 with this API.
     48 
     49 # %PROTOCOLS%
     50 
     51 # EXAMPLE
     52 
     53 ~~~c
     54 int main(void)
     55 {
     56   CURL *curl = curl_easy_init();
     57   if(curl) {
     58     CURLcode res;
     59     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
     60     curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
     61     res = curl_easy_perform(curl);
     62     curl_easy_cleanup(curl);
     63   }
     64 }
     65 ~~~
     66 
     67 # %AVAILABILITY%
     68 
     69 # RETURN VALUE
     70 
     71 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     72 
     73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     74 libcurl-errors(3).