CURLINFO_SPEED_UPLOAD.md (1386B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLINFO_SPEED_UPLOAD 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_SPEED_DOWNLOAD_T (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11 Protocol: 12 - All 13 Added-in: 7.4.1 14 --- 15 16 # NAME 17 18 CURLINFO_SPEED_UPLOAD - get upload speed 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_UPLOAD, double *speed); 26 ~~~ 27 28 # DESCRIPTION 29 30 Pass a pointer to a double to receive the average upload speed that curl 31 measured for the complete upload. Measured in bytes/second. 32 33 CURLINFO_SPEED_UPLOAD_T(3) is a newer replacement that returns a more 34 sensible variable type. 35 36 # %PROTOCOLS% 37 38 # EXAMPLE 39 40 ~~~c 41 int main(void) 42 { 43 CURL *curl = curl_easy_init(); 44 if(curl) { 45 CURLcode res; 46 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 47 48 /* Perform the request */ 49 res = curl_easy_perform(curl); 50 51 if(!res) { 52 double speed; 53 res = curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &speed); 54 if(!res) { 55 printf("Upload speed %.0f bytes/sec\n", speed); 56 } 57 } 58 } 59 } 60 ~~~ 61 62 # DEPRECATED 63 64 Deprecated since 7.55.0. 65 66 # %AVAILABILITY% 67 68 # RETURN VALUE 69 70 curl_easy_getinfo(3) returns a CURLcode indicating success or error. 71 72 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 73 libcurl-errors(3).