CURLINFO_XFER_ID.md (1487B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLINFO_XFER_ID 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_CONN_ID (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11 Protocol: 12 - All 13 Added-in: 8.2.0 14 --- 15 16 # NAME 17 18 CURLINFO_XFER_ID - get the ID of a transfer 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_XFER_ID, 26 curl_off_t *xfer_id); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a pointer to a *curl_off_t* to receive the identifier of the 32 current/last transfer done with the handle. Stores -1 if no transfer 33 has been started yet for the handle. 34 35 The transfer id is unique among all transfers performed using the same 36 connection cache. This is implicitly the case for all transfers in the 37 same multi handle. 38 39 # %PROTOCOLS% 40 41 # EXAMPLE 42 43 ~~~c 44 int main(void) 45 { 46 CURL *curl = curl_easy_init(); 47 if(curl) { 48 CURLcode res; 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 50 51 /* Perform the request */ 52 res = curl_easy_perform(curl); 53 54 if(!res) { 55 curl_off_t xfer_id; 56 res = curl_easy_getinfo(curl, CURLINFO_XFER_ID, &xfer_id); 57 if(!res) { 58 printf("Transfer ID: %" CURL_FORMAT_CURL_OFF_T "\n", xfer_id); 59 } 60 } 61 } 62 } 63 ~~~ 64 65 # %AVAILABILITY% 66 67 # RETURN VALUE 68 69 curl_easy_getinfo(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).