• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_multi_init
5Section: 3
6Source: libcurl
7See-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---
14
15# NAME
16
17curl_multi_init - create a multi handle
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLM *curl_multi_init();
25~~~
26
27# DESCRIPTION
28
29This function returns a pointer to a *CURLM* handle to be used as input to
30all the other multi-functions, sometimes referred to as a multi handle in some
31places in the documentation. This init call MUST have a corresponding call to
32curl_multi_cleanup(3) when the operation is complete.
33
34# EXAMPLE
35
36~~~c
37int main(void)
38{
39  /* init a multi stack */
40  CURLM *multi = curl_multi_init();
41  CURL *curl = curl_easy_init();
42  CURL *curl2 = curl_easy_init();
43
44  /* add individual transfers */
45  curl_multi_add_handle(multi, curl);
46  curl_multi_add_handle(multi, curl2);
47}
48~~~
49
50# AVAILABILITY
51
52Added in 7.9.6
53
54# RETURN VALUE
55
56If this function returns NULL, something went wrong and you cannot use the
57other curl functions.
58