CURLINFO_CONN_ID.3 1.4 KB

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