curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: What use/example multi handle.

From: Daniel Stenberg via curl-users <curl-users_at_lists.haxx.se>
Date: Fri, 11 Feb 2022 08:31:44 +0100 (CET)

On Fri, 11 Feb 2022, Stef Bon wrote:

> My question is is a transfer here the same as a connection?

The libcurl API is transfer-oriented, not connection based. You create, setup
and perform transfers with libcurl. Under the hood that of course often result
in connection(s).

> Ok. What is the effect of the number of handles (created with
> curl_easy_init(), and added with curl_multi_add_handle() ) on the number of
> connections?

It depends on details, protocol, options and timing. If you do X HTTP/1
transfers in parallel and they're all successful and they all truly run at the
same time, then that will use X simultaneous connections. But also note that X
connections done by libcurl does not mean exactly X sockets used.

> The way I look at it is that the context/application uses the handles, and
> decides how many handles it uses (it is possible to do that a dynamic way).
> libcurl decides to create one or more connections to serve the requests.
> That may depend on the protocol used. Do I think correct?

Correct. And how you limit and instruct libcurl with options such as
CURLMOPT_MAX_HOST_CONNECTIONS and CURLMOPT_MAX_TOTAL_CONNECTIONS etc.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-02-11