cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: easy argument in curl_multi_socket_action's callback function

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 9 Dec 2015 00:43:22 +0100 (CET)

On Mon, 7 Dec 2015, Dan Tsohar wrote:

> I am trying to wrap my head around something about the
> curl_multi_socket_action API. The Doc about curl_multi_socket_action's
> callback says: "The easy argument is a pointer to the easy handle that deals
> with this particular socket. Note that a single handle may work with several
> sockets simultaneously." Assuming I am setting CURLOPT_FRESH_CONNECT to 1
> for every easy handle that is created during my run, how would it be
> possible to have more than one socket for one particular easy handle?

1. libcurl supports happy eyeballs, which means trying to connect two sockets
at once, closing the slower one when the fastest connects.

2. FTP has two connections == two sockets

3. When using c-ares for name resolving, that socket is exposed to the app in
a multi_socket case and I'm not sure it always gets closed before the
connection sockets are created.

4. we will reserve the right to invent more methods in the future that might
use another socket so by documenting this, it is your applications that is
wrong and not libcurl if you make such assumptions and break in the future!

5. there might of course also be bugs...

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-12-09