quickjs-tart

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

CURLOPT_CONNECTTIMEOUT_MS.md (2418B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_CONNECTTIMEOUT_MS
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_LOW_SPEED_LIMIT (3)
      9   - CURLOPT_MAX_RECV_SPEED_LARGE (3)
     10   - CURLOPT_TIMEOUT_MS (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.16.2
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_CONNECTTIMEOUT_MS - timeout for the connect phase
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS,
     26                           long timeout);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 Pass a long. It sets the maximum time in milliseconds that you allow the
     32 connection phase to take. This timeout only limits the connection phase, it
     33 has no impact once libcurl has connected. The connection phase includes the
     34 name resolve (DNS) and all protocol handshakes and negotiations until there is
     35 an established connection with the remote side.
     36 
     37 Set this option to zero to switch to the default built-in connection timeout -
     38 300 seconds. See also the CURLOPT_TIMEOUT_MS(3) option.
     39 
     40 CURLOPT_CONNECTTIMEOUT(3) is the same function but set in seconds.
     41 
     42 If both CURLOPT_CONNECTTIMEOUT(3) and CURLOPT_CONNECTTIMEOUT_MS(3) are set,
     43 the value set last is used.
     44 
     45 The connection timeout is included in the general all-covering
     46 CURLOPT_TIMEOUT_MS(3):
     47 
     48 With CURLOPT_CONNECTTIMEOUT_MS(3) set to 3000 and CURLOPT_TIMEOUT_MS(3) set to
     49 5000, the operation can never last longer than 5000 milliseconds, and the
     50 connection phase cannot last longer than 3000 milliseconds.
     51 
     52 With CURLOPT_CONNECTTIMEOUT_MS(3) set to 4000 and CURLOPT_TIMEOUT_MS(3) set to
     53 2000, the operation can never last longer than 2000 milliseconds. Including
     54 the connection phase.
     55 
     56 This option may cause libcurl to use the SIGALRM signal to timeout system
     57 calls on builds not using asynch DNS. In Unix-like systems, this might cause
     58 signals to be used unless CURLOPT_NOSIGNAL(3) is set.
     59 
     60 # DEFAULT
     61 
     62 300000
     63 
     64 # %PROTOCOLS%
     65 
     66 # EXAMPLE
     67 
     68 ~~~c
     69 int main(void)
     70 {
     71   CURL *curl = curl_easy_init();
     72   if(curl) {
     73     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     74 
     75     /* complete connection within 10000 milliseconds */
     76     curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
     77 
     78     curl_easy_perform(curl);
     79   }
     80 }
     81 ~~~
     82 
     83 # %AVAILABILITY%
     84 
     85 # RETURN VALUE
     86 
     87 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     88 
     89 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     90 libcurl-errors(3).