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