CURLINFO_XFER_ID.3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .\" generated by cd2nroff 0.1 from CURLINFO_XFER_ID.md
  2. .TH CURLINFO_XFER_ID 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLINFO_XFER_ID \- get the ID of a transfer
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_XFER_ID,
  9. curl_off_t *xfer_id);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a \fIcurl_off_t\fP to receive the identifier of the
  13. current/last transfer done with the handle. Stores \-1 if no transfer
  14. has been started yet for the handle.
  15. The transfer id is unique among all transfers performed using the same
  16. connection cache. This is implicitly the case for all transfers in the
  17. same multi handle.
  18. .SH PROTOCOLS
  19. This functionality affects all supported protocols
  20. .SH EXAMPLE
  21. .nf
  22. int main(void)
  23. {
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. CURLcode res;
  27. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  28. /* Perform the request */
  29. res = curl_easy_perform(curl);
  30. if(!res) {
  31. curl_off_t xfer_id;
  32. res = curl_easy_getinfo(curl, CURLINFO_XFER_ID, &xfer_id);
  33. if(!res) {
  34. printf("Transfer ID: %" CURL_FORMAT_CURL_OFF_T "\\n", xfer_id);
  35. }
  36. }
  37. }
  38. }
  39. .fi
  40. .SH AVAILABILITY
  41. Added in curl 8.2.0
  42. .SH RETURN VALUE
  43. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  44. .SH SEE ALSO
  45. .BR CURLINFO_CONN_ID (3),
  46. .BR curl_easy_getinfo (3),
  47. .BR curl_easy_setopt (3)