running = multi:SocketAction(socket, mask)
multi:SocketAction()
with the socket
argument get to the socket with the action. When the events on a socket are known, they can be passed
as an events bitmask mask
by first setting mask
to 0, and then adding using bitwise OR (|) any combination of events
to be chosen from #CURL_CSELECT_IN
, #CURL_CSELECT_OUT
or #CURL_CSELECT_ERR
. When the events on a socket are unknown,
pass 0 instead, and libcurl will test the descriptor internally. It is also permissible to pass #CURL_SOCKET_TIMEOUT
to the socket
parameter in order to initiate the whole process or when a timeout occurs.
At return, running
contains the number of running easy handles within the multi handle. When this number reaches zero,
all transfers are complete/done. When you call multi:SocketAction()
on a specific socket and the counter decreases
by one, it DOES NOT necessarily mean that this exact socket/transfer is the one that completed. Use multi:InfoRead()
to figure out which easy handle that completed.
The multi:SocketAction()
functions inform the application about updates in the socket (file descriptor) status by
doing none, one, or multiple calls to the socket callback function get with the #CURLMOPT_SOCKETFUNCTION
option to
multi:SetOpt(). They update the status with changes since the previous time the callback was called.
Get the timeout time by setting the #CURLMOPT_TIMERFUNCTION
option with multi:SetOpt(). Your application will then
get called with information on how long to wait for socket actions at most before doing the timeout action: call the
multi:SocketAction()
function with the socket
argument get to #CURL_SOCKET_TIMEOUT
. You can also use the
multi:Timeout() function to poll the value at any given time, but for an event-based system using the callback is
far better than relying on polling the timeout value.