curl-library
Re: curl_multi_socket_action: second argument?
Date: Thu, 21 Jun 2012 15:12:49 +0200 (CEST)
On Wed, 20 Jun 2012, Felix E. Klee wrote:
> What is the difference between calling `curl_multi_socket_action` with a
> socket as second argument and with `CURL_SOCKET_TIMEOUT`?
In the first case you're telling libcurl some activity is happening on the
given socket, and in the other case you're saying that the timeout has
triggered.
> My assumption:
>
> * With socket as second argument:
>
> a) Calls `CURLOPT_WRITEFUNCTION` with data retrieved via that socket
> since the last call.
If data gets received, yes. Socket activity can mean several other things as
well.
> b) Checks status of the socket. If status has changed, then calls:
>
> CURLMOPT_SOCKETFUNCTION
If something internally has changed so that your program should wait for
another activity on the socket than what it already has been told to, then yes
it will happen.
> * With `CURL_SOCKET_TIMEOUT`:
>
> Checks statuses of *all sockets*, and for each socket whose status has
> changed, calls:
>
> CURLMOPT_SOCKETFUNCTION
No. It goes through all easy-handles that have reached the timeout time and
checks if there's anything to do for them due to the timeout. It can lead to
calls to the CURLMOPT_SOCKETFUNCTION sure, but also to CURLMOPT_TIMERFUNCTION
or none at all, depending on the exact circumstances.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2012-06-21