curl_easy_pause.3 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. .\" $Id$
  2. .\"
  3. .TH curl_easy_pause 3 "17 Dec 2007" "libcurl 7.18.0" "libcurl Manual"
  4. .SH NAME
  5. curl_easy_pause - pause and unpause a connection
  6. .SH SYNOPSIS
  7. .B #include <curl/curl.h>
  8. .BI "CURLcode curl_easy_pause(CURL *"handle ", int "bitmask " );"
  9. .SH DESCRIPTION
  10. Using this function, you can explicitly mark a running connection to get
  11. paused, and you can unpause a connection that was previously paused.
  12. A connection can be paused by using this function or by letting the read
  13. or the write callbacks return the proper magic return code
  14. (\fICURL_READFUNC_PAUSE\fP and \fICURL_WRITEFUNC_PAUSE\fP). A write callback
  15. that returns pause signals to the library that it couldn't take care of any
  16. data at all, and that data will then be delivered again to the callback when
  17. the writing is later unpaused.
  18. NOTE: while it may feel tempting, take care and notice that you cannot call
  19. this function from another thread.
  20. When this function is called to unpause reading, the chance is high that you
  21. will get your write callback called before this function returns.
  22. The \fBhandle\fP argument is of course identifying the handle that operates on
  23. the connection you want to pause or unpause.
  24. The \fBbitmask\fP argument is a set of bits that sets the new state of the
  25. connection. The following bits can be used:
  26. .IP CURLPAUSE_RECV
  27. Pause receiving data. There will be no data received on this connection until
  28. this function is called again without this bit set. Thus, the write callback
  29. (\fICURLOPT_WRITEFUNCTION\fP) won't be called.
  30. .IP CURLPAUSE_SEND
  31. Pause sending data. There will be no data sent on this connection until this
  32. function is called again without this bit set. Thus, the read callback
  33. (\fICURLOPT_READFUNCTION\fP) won't be called.
  34. .IP CURLPAUSE_ALL
  35. Convenience define that pauses both directions.
  36. .IP CURLPAUSE_CONT
  37. Convenience define that unpauses both directions
  38. .SH RETURN VALUE
  39. CURLE_OK (zero) means that the option was set properly, and a non-zero return
  40. code means something wrong occurred after the new state was set. See the
  41. \fIlibcurl-errors(3)\fP man page for the full list with descriptions.
  42. .SH AVAILABILITY
  43. This function was added in libcurl 7.18.0. Before this version, there was no
  44. explicit support for pausing transfers.
  45. .SH "MEMORY USE"
  46. When pausing a read by returning the magic return code from a write callback,
  47. the read data is already in libcurl's internal buffers so it'll have to keep
  48. it in an allocated buffer until the reading is again unpaused using this
  49. function.
  50. If the downloaded data is compressed and is asked to get uncompressed
  51. automatically on download, libcurl will continue to uncompress the entire
  52. downloaded chunk and it will cache the data uncompressed. This has the side-
  53. effect that if you download something that is compressed a lot, it can result
  54. in a very large data amount needing to be allocated to save the data during
  55. the pause. This said, you should probably consider not using paused reading if
  56. you allow libcurl to uncompress data automatically.
  57. .SH "SEE ALSO"
  58. .BR curl_easy_cleanup "(3), " curl_easy_reset "(3)"