xref: /curl/docs/libcurl/curl_multi_setopt.md (revision e3fe0200)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_multi_setopt
5Section: 3
6Source: libcurl
7See-also:
8  - curl_multi_cleanup (3)
9  - curl_multi_info_read (3)
10  - curl_multi_init (3)
11  - curl_multi_socket (3)
12Protocol:
13  - All
14---
15
16# NAME
17
18curl_multi_setopt - set options for a curl multi handle
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option, parameter);
26~~~
27
28# DESCRIPTION
29
30curl_multi_setopt(3) is used to tell a libcurl multi handle how to
31behave. By using the appropriate options to curl_multi_setopt(3), you
32can change libcurl's behavior when using that multi handle. All options are
33set with the *option* followed by the *parameter*. That parameter can
34be a **long**, a **function pointer**, an **object pointer** or a
35**curl_off_t** type, depending on what the specific option expects. Read
36this manual carefully as bad input values may cause libcurl to behave
37badly. You can only set one option in each function call.
38
39# OPTIONS
40
41## CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE
42
43See CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3)
44
45## CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE
46
47See CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3)
48
49## CURLMOPT_MAX_HOST_CONNECTIONS
50
51See CURLMOPT_MAX_HOST_CONNECTIONS(3)
52
53## CURLMOPT_MAX_PIPELINE_LENGTH
54
55See CURLMOPT_MAX_PIPELINE_LENGTH(3)
56
57## CURLMOPT_MAX_TOTAL_CONNECTIONS
58
59See CURLMOPT_MAX_TOTAL_CONNECTIONS(3)
60
61## CURLMOPT_MAXCONNECTS
62
63See CURLMOPT_MAXCONNECTS(3)
64
65## CURLMOPT_PIPELINING
66
67See CURLMOPT_PIPELINING(3)
68
69## CURLMOPT_PIPELINING_SITE_BL
70
71See CURLMOPT_PIPELINING_SITE_BL(3)
72
73## CURLMOPT_PIPELINING_SERVER_BL
74
75See CURLMOPT_PIPELINING_SERVER_BL(3)
76
77## CURLMOPT_PUSHFUNCTION
78
79See CURLMOPT_PUSHFUNCTION(3)
80
81## CURLMOPT_PUSHDATA
82
83See CURLMOPT_PUSHDATA(3)
84
85## CURLMOPT_SOCKETFUNCTION
86
87See CURLMOPT_SOCKETFUNCTION(3)
88
89## CURLMOPT_SOCKETDATA
90
91See CURLMOPT_SOCKETDATA(3)
92
93## CURLMOPT_TIMERFUNCTION
94
95See CURLMOPT_TIMERFUNCTION(3)
96
97## CURLMOPT_TIMERDATA
98
99See CURLMOPT_TIMERDATA(3)
100
101## CURLMOPT_MAX_CONCURRENT_STREAMS
102
103See CURLMOPT_MAX_CONCURRENT_STREAMS(3)
104
105# EXAMPLE
106
107~~~c
108
109#define MAX_PARALLEL 45
110
111int main(void)
112{
113  CURLM *multi;
114  /* Limit the amount of simultaneous connections curl should allow: */
115  curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
116}
117~~~
118
119# AVAILABILITY
120
121Added in 7.15.4
122
123# RETURN VALUE
124
125The standard CURLMcode for multi interface error codes. Note that it returns a
126CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl
127does not know of.
128