curl_multi_perform.3 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2011, 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 http://curl.haxx.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. .\" **************************************************************************
  22. .TH curl_multi_perform 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
  23. .SH NAME
  24. curl_multi_perform - reads/writes available data from each easy handle
  25. .SH SYNOPSIS
  26. #include <curl/curl.h>
  27. CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles);
  28. .ad
  29. .SH DESCRIPTION
  30. When the app thinks there's data available for the multi_handle, it should
  31. call this function to read/write whatever there is to read or write right
  32. now. curl_multi_perform() returns as soon as the reads/writes are done. This
  33. function does not require that there actually is any data available for
  34. reading or that data can be written, it can be called just in case. It will
  35. write the number of handles that still transfer data in the second argument's
  36. integer-pointer.
  37. When you call curl_multi_perform() and the amount of \fIrunning_handles\fP is
  38. changed from the previous call (or is less than the amount of easy handles
  39. you've added to the multi handle), you know that there is one or more
  40. transfers less "running". You can then call \fIcurl_multi_info_read(3)\fP to
  41. get information about each individual completed transfer, and that returned
  42. info includes CURLcode and more. If an added handle fails very quickly, it may
  43. never be counted as a running_handle.
  44. When \fIrunning_handles\fP is set to zero (0) on the return of this function,
  45. there is no longer any transfers in progress.
  46. .SH "RETURN VALUE"
  47. CURLMcode type, general libcurl multi interface error code.
  48. Before version 7.20.0: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this
  49. basically means that you should call \fIcurl_multi_perform\fP again, before
  50. you select() on more actions. You don't have to do it immediately, but the
  51. return code means that libcurl may have more data available to return or that
  52. there may be more data to send off before it is "satisfied". Do note that
  53. \fIcurl_multi_perform(3)\fP will return \fICURLM_CALL_MULTI_PERFORM\fP only
  54. when it wants to be called again \fBimmediately\fP. When things are fine and
  55. there is nothing immediate it wants done, it'll return \fICURLM_OK\fP and you
  56. need to wait for \&"action" and then call this function again.
  57. This function only returns errors etc regarding the whole multi stack.
  58. Problems still might have occurred on individual transfers even when this
  59. function returns \fICURLM_OK\fP.
  60. .SH "TYPICAL USAGE"
  61. Most applications will use \fIcurl_multi_fdset(3)\fP to get the multi_handle's
  62. file descriptors, then it'll wait for action on them using \fBselect(3)\fP and
  63. as soon as one or more of them are ready, \fIcurl_multi_perform(3)\fP gets
  64. called.
  65. .SH "SEE ALSO"
  66. .BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
  67. .BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
  68. .BR libcurl-errors "(3)"