1curl_multi_add_handle(3) libcurl Manual curl_multi_add_handle(3)
2
3
4
6 curl_multi_add_handle - add an easy handle to a multi session
7
9 #include <curl/curl.h>
10
11 CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *easy_han‐
12 dle);
13
15 Adds a standard easy handle to the multi stack. This function call will
16 make this multi_handle control the specified easy_handle.
17
18 While an easy handle is added to a multi stack, you cannot and you must
19 not use curl_easy_perform(3) on that handle. After having removed the
20 easy handle from the multi stack again, it is perfectly fine to use it
21 with the easy interface again.
22
23 If the easy handle is not set to use a shared (CURLOPT_SHARE(3)) or
24 global DNS cache (CURLOPT_DNS_USE_GLOBAL_CACHE(3)), it will be made to
25 use the DNS cache that is shared between all easy handles within the
26 multi handle when curl_multi_add_handle(3) is called.
27
28 When an easy interface is added to a multi handle, it will use a shared
29 connection cache owned by the multi handle. Removing and adding new
30 easy handles will not affect the pool of connections or the ability to
31 do connection re-use.
32
33 If you have CURLMOPT_TIMERFUNCTION(3) set in the multi handle (and you
34 really should if you're working event-based with
35 curl_multi_socket_action(3) and friends), that callback will be called
36 from within this function to ask for an updated timer so that your main
37 event loop will get the activity on this handle to get started.
38
39 The easy handle will remain added to the multi handle until you remove
40 it again with curl_multi_remove_handle(3) - even when a transfer with
41 that specific easy handle is completed.
42
43 You should remove the easy handle from the multi stack before you ter‐
44 minate first the easy handle and then the multi handle:
45
46 1 - curl_multi_remove_handle(3)
47
48 2 - curl_easy_cleanup(3)
49
50 3 - curl_multi_cleanup(3)
51
53 CURLMcode type, general libcurl multi interface error code.
54
56 curl_multi_cleanup(3),curl_multi_init(3), curl_multi_setopt(3),
57 curl_multi_socket_action(3)
58
59
60
61libcurl 7.66.0 June 30, 2018 curl_multi_add_handle(3)