On Fri, 5 May 2017, Pahome Chen via curl-library wrote:

curl_multi_socket_action(CURLM * multi_handle,
                        *curl_socket_t sockfd*,
                        int ev_bitmask,
                        int *running_handles);

It always said that we can set to the socket *sockfd *with *action*, it doesn't mentioned what's the functionality of *sockfd *in the function.That makes me confused.

It is mentioned in several places in the documentation, and I've explained it in previous replies. But let me try again.

curl_multi_socket_action is part of the multi_socket API. It is an event-based API. It assumes that you use an event-based library or underlying system that tells you when there's activity/action on one of the sockets/file descriptors you've asked it to monitor.

When you use curl_multi_socket_action(), you get told by libcurl which file descriptors to wait for and for what particular activity on that socket. You should then set that information in your event-based library.

Then, when your event-lib tells you there actually is actitity on the socket that it monitors on the behalf of libcurl, it probably calls a callback you have provided for it.

You then call curl_multi_socket_action() to tell libcurl about which socket that got action and what particular action it was that was detected. That socket is the 'sockfd' argument to curl_multi_socket_action() and 'ev_bitmask' is what activity/events that happened on the socket.

--

 / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to