curl_multi_get_handles.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .\" generated by cd2nroff 0.1 from curl_multi_get_handles.md
  2. .TH curl_multi_get_handles 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_multi_get_handles \- return all added easy handles
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURL **curl_multi_get_handles(CURLM *multi_handle);
  9. .fi
  10. .SH DESCRIPTION
  11. Returns an array with pointers to all added easy handles. The end of the list
  12. is marked with a NULL pointer.
  13. Even if there is not a single easy handle added, this still returns an array
  14. but with only a single NULL pointer entry.
  15. The returned array contains all the handles that are present at the time of
  16. the call. As soon as a handle has been removed from or a handle has been added
  17. to the multi handle after the handle array was returned, the two data points
  18. are out of sync.
  19. The order of the easy handles within the array is not guaranteed.
  20. The returned array must be freed with a call to \fIcurl_free(3)\fP after use.
  21. .SH PROTOCOLS
  22. This functionality affects all supported protocols
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. /* init a multi stack */
  28. CURLM *multi = curl_multi_init();
  29. CURL *curl = curl_easy_init();
  30. if(curl) {
  31. /* add the transfer */
  32. curl_multi_add_handle(multi, curl);
  33. /* extract all added handles */
  34. CURL **list = curl_multi_get_handles(multi);
  35. if(list) {
  36. int i;
  37. /* remove all added handles */
  38. for(i = 0; list[i]; i++) {
  39. curl_multi_remove_handle(multi, list[i]);
  40. }
  41. curl_free(list);
  42. }
  43. }
  44. }
  45. .fi
  46. .SH AVAILABILITY
  47. Added in curl 8.4.0
  48. .SH RETURN VALUE
  49. Returns NULL on failure. Otherwise it returns a pointer to an allocated array.
  50. .SH SEE ALSO
  51. .BR curl_multi_add_handle (3),
  52. .BR curl_multi_cleanup (3),
  53. .BR curl_multi_init (3),
  54. .BR curl_multi_remove_handle (3)