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