curl_multi_init.md (1388B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: curl_multi_init 5 Section: 3 6 Source: libcurl 7 See-also: 8 - curl_easy_init (3) 9 - curl_global_init (3) 10 - curl_multi_add_handle (3) 11 - curl_multi_cleanup (3) 12 - curl_multi_get_handles (3) 13 Protocol: 14 - All 15 Added-in: 7.9.6 16 --- 17 18 # NAME 19 20 curl_multi_init - create a multi handle 21 22 # SYNOPSIS 23 24 ~~~c 25 #include <curl/curl.h> 26 27 CURLM *curl_multi_init(); 28 ~~~ 29 30 # DESCRIPTION 31 32 This function returns a pointer to a *CURLM* handle to be used as input to 33 all the other multi-functions, sometimes referred to as a multi handle in some 34 places in the documentation. This init call MUST have a corresponding call to 35 curl_multi_cleanup(3) when the operation is complete. 36 37 By default, several caches are stored in and held by the multi handle: DNS 38 cache, connection pool, TLS session ID cache and the TLS CA cert cache. All 39 transfers using the same multi handle share these caches. 40 41 # %PROTOCOLS% 42 43 # EXAMPLE 44 45 ~~~c 46 int main(void) 47 { 48 /* init a multi stack */ 49 CURLM *multi = curl_multi_init(); 50 CURL *curl = curl_easy_init(); 51 CURL *curl2 = curl_easy_init(); 52 53 /* add individual transfers */ 54 curl_multi_add_handle(multi, curl); 55 curl_multi_add_handle(multi, curl2); 56 } 57 ~~~ 58 59 # %AVAILABILITY% 60 61 # RETURN VALUE 62 63 If this function returns NULL, something went wrong and you cannot use the 64 other curl functions.