CURLINFO_XFER_ID.3 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLINFO_XFER_ID 3 "07 June 2023" "libcurl" "libcurl"
  26. .SH NAME
  27. CURLINFO_XFER_ID \- get the ID of a transfer
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_XFER_ID,
  32. curl_off_t *xfer_id);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a pointer to a \fIcurl_off_t\fP to receive the identifier of the
  36. current/last transfer done with the handle. Stores -1 if no transfer
  37. has been started yet for the handle.
  38. The transfer id is unique among all transfers performed using the same
  39. connection cache. This is implicitly the case for all transfers in the
  40. same multi handle.
  41. .SH PROTOCOLS
  42. All
  43. .SH EXAMPLE
  44. .nf
  45. CURL *curl = curl_easy_init();
  46. if(curl) {
  47. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  48. /* Perform the request */
  49. res = curl_easy_perform(curl);
  50. if(!res) {
  51. curl_off_t xfer_id;
  52. res = curl_easy_getinfo(curl, CURLINFO_XFER_ID, &xfer_id);
  53. if(!res) {
  54. printf("Transfer ID: %" CURL_FORMAT_CURL_OFF_T "\\n", xfer_id);
  55. }
  56. }
  57. }
  58. .fi
  59. .SH AVAILABILITY
  60. Added in 8.2.0
  61. .SH RETURN VALUE
  62. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  63. .SH "SEE ALSO"
  64. .BR curl_easy_getinfo "(3), " curl_easy_setopt "(3), "
  65. .BR CURLINFO_CONN_ID "(3), "