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