CURLOPT_MAX_RECV_SPEED_LARGE.md (1659B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_MAX_RECV_SPEED_LARGE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_LOW_SPEED_LIMIT (3) 9 - CURLOPT_MAX_SEND_SPEED_LARGE (3) 10 - CURLOPT_TIMEOUT (3) 11 Protocol: 12 - All 13 Added-in: 7.15.5 14 --- 15 16 # NAME 17 18 CURLOPT_MAX_RECV_SPEED_LARGE - rate limit data download speed 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAX_RECV_SPEED_LARGE, 26 curl_off_t maxspeed); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a curl_off_t as parameter. If a download exceeds this *maxspeed* 32 (counted in bytes per second) the transfer pauses to keep the average speed 33 less than or equal to the parameter value. Defaults to unlimited speed. 34 35 This is not an exact science. libcurl attempts to keep the average speed below 36 the given threshold over a period time. 37 38 If you set *maxspeed* to a value lower than CURLOPT_BUFFERSIZE(3), 39 libcurl might download faster than the set limit initially. 40 41 This option does not affect transfer speeds done with FILE:// URLs. 42 43 # DEFAULT 44 45 0, disabled 46 47 # %PROTOCOLS% 48 49 # EXAMPLE 50 51 ~~~c 52 int main(void) 53 { 54 CURL *curl = curl_easy_init(); 55 if(curl) { 56 CURLcode ret; 57 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 58 /* cap the download speed to 31415 bytes/sec */ 59 curl_easy_setopt(curl, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)31415); 60 ret = curl_easy_perform(curl); 61 } 62 } 63 ~~~ 64 65 # %AVAILABILITY% 66 67 # RETURN VALUE 68 69 curl_easy_setopt(3) returns a CURLcode indicating success or error. 70 71 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 72 libcurl-errors(3).