-
-
Notifications
You must be signed in to change notification settings - Fork 11
libcURL.MultiHandle.PerformOnce
libcURL.MultiHandle.PerformOnce
Function PerformOnce() As Boolean
Returns True
until all transfers have completed. Call PerformOnce
again until it returns False
.
Each invocation of this method will perform as much of each outstanding transfer as is immediately possible and then return. The TransferComplete
event will be raised for any completed transfers.
Unlike MultiHandle.Perform
, this method will raise all EasyHandle
and MultiHandle
events on the calling thread instead of always on the main thread.
Under no circumstances should PerformOnce
be called, directly or indirectly, from EasyHandle
or MultiHandle
events. Doing so will create a recursive loop and overflow the call stack.
This example sets up a transfer using the EasyHandle class, and then adds it to an instance of MultiHandle
. PerformOnce
is called multiple times by a simple loop that yields between each call.
Dim curl As New libcURL.EasyHandle
curl.URL = "http://www.example.com/"
Dim output As New MemoryBlock(0)
Dim outstream As New BinaryStream(output)
curl.DownloadStream = outstream
Dim multi As New libcURL.MultiHandle
If Not multi.AddTransfer(curl) Then
MsgBox("cURL error: " + libcURL.FormatMultiError(multi.LastError))
End If
Do Until Not multi.PerformOnce() ' do a little bit of the transfer
App.YieldToNextThread
Loop
outstream.Close
If curl.LastError <> 0 Then
MsgBox("cURL error: " + libcURL.FormatError(curl.LastError))
End If
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.