quickjs-tart

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

CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md (1789B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS
      5 Section: 3
      6 Source: libcurl
      7 Protocol:
      8   - All
      9 See-also:
     10   - CURLOPT_CONNECTTIMEOUT_MS (3)
     11   - CURLOPT_LOW_SPEED_LIMIT (3)
     12   - CURLOPT_TIMEOUT (3)
     13 Added-in: 7.59.0
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS - head start for IPv6 for happy eyeballs
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS,
     26                           long timeout);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Happy eyeballs is an algorithm that attempts to connect to both IPv4 and IPv6
     32 addresses for dual-stack hosts, preferring IPv6 first for *timeout*
     33 milliseconds. If the IPv6 address cannot be connected to within that time then
     34 a connection attempt is made to the IPv4 address in parallel. The first
     35 connection to be established is the one that is used.
     36 
     37 The range of suggested useful values for *timeout* is limited. Happy
     38 Eyeballs RFC 6555 says "It is RECOMMENDED that connection attempts be paced
     39 150-250 ms apart to balance human factors against network load." libcurl
     40 currently defaults to 200 ms. Firefox and Chrome currently default to 300 ms.
     41 
     42 # DEFAULT
     43 
     44 CURL_HET_DEFAULT (currently defined as 200L)
     45 
     46 # %PROTOCOLS%
     47 
     48 # EXAMPLE
     49 
     50 ~~~c
     51 int main(void)
     52 {
     53   CURL *curl = curl_easy_init();
     54   if(curl) {
     55     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     56     curl_easy_setopt(curl, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 300L);
     57 
     58     curl_easy_perform(curl);
     59 
     60     /* always cleanup */
     61     curl_easy_cleanup(curl);
     62   }
     63 }
     64 ~~~
     65 
     66 # %AVAILABILITY%
     67 
     68 # RETURN VALUE
     69 
     70 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     71 
     72 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     73 libcurl-errors(3).