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 14Added-in: 7.15.4 15--- 16 17# NAME 18 19curl_multi_setopt - set options for a curl multi handle 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLMcode curl_multi_setopt(CURLM *multi, CURLMoption option, parameter); 27~~~ 28 29# DESCRIPTION 30 31curl_multi_setopt(3) is used to tell a libcurl multi handle how to behave. By 32using the appropriate options to curl_multi_setopt(3), you can change 33libcurl's behavior when using that multi handle. All options are set with the 34*option* followed by the *parameter*. That parameter can be a **long**, a 35**function pointer**, an **object pointer** or a **curl_off_t** type, 36depending on what the specific option expects. Read this manual carefully as 37bad input values may cause libcurl to behave badly. You can only set one 38option in each function call. 39 40# OPTIONS 41 42## CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE 43 44**deprecated** See CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE(3) 45 46## CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE 47 48**deprecated** See CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE(3) 49 50## CURLMOPT_MAXCONNECTS 51 52Size of connection cache. See CURLMOPT_MAXCONNECTS(3) 53 54## CURLMOPT_MAX_CONCURRENT_STREAMS 55 56Max concurrent streams for http2. See CURLMOPT_MAX_CONCURRENT_STREAMS(3) 57 58## CURLMOPT_MAX_HOST_CONNECTIONS 59 60Max number of connections to a single host. See 61CURLMOPT_MAX_HOST_CONNECTIONS(3) 62 63## CURLMOPT_MAX_PIPELINE_LENGTH 64 65**deprecated**. See CURLMOPT_MAX_PIPELINE_LENGTH(3) 66 67## CURLMOPT_MAX_TOTAL_CONNECTIONS 68 69Max simultaneously open connections. See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) 70 71## CURLMOPT_PIPELINING 72 73Enable HTTP multiplexing. See CURLMOPT_PIPELINING(3) 74 75## CURLMOPT_PIPELINING_SERVER_BL 76 77**deprecated**. See CURLMOPT_PIPELINING_SERVER_BL(3) 78 79## CURLMOPT_PIPELINING_SITE_BL 80 81**deprecated**. See CURLMOPT_PIPELINING_SITE_BL(3) 82 83## CURLMOPT_PUSHDATA 84 85Pointer to pass to push callback. See CURLMOPT_PUSHDATA(3) 86 87## CURLMOPT_PUSHFUNCTION 88 89Callback that approves or denies server pushes. See CURLMOPT_PUSHFUNCTION(3) 90 91## CURLMOPT_SOCKETDATA 92 93Custom pointer passed to the socket callback. See CURLMOPT_SOCKETDATA(3) 94 95## CURLMOPT_SOCKETFUNCTION 96 97Callback informed about what to wait for. See CURLMOPT_SOCKETFUNCTION(3) 98 99## CURLMOPT_TIMERDATA 100 101Custom pointer to pass to timer callback. See CURLMOPT_TIMERDATA(3) 102 103## CURLMOPT_TIMERFUNCTION 104 105Callback to receive timeout values. See CURLMOPT_TIMERFUNCTION(3) 106 107# %PROTOCOLS% 108 109# EXAMPLE 110 111~~~c 112 113#define MAX_PARALLEL 45 114 115int main(void) 116{ 117 CURLM *multi; 118 /* Limit the amount of simultaneous connections curl should allow: */ 119 curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL); 120} 121~~~ 122 123# %AVAILABILITY% 124 125# RETURN VALUE 126 127The standard CURLMcode for multi interface error codes. Note that it returns a 128CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl 129does not know of. 130