curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sending concurrent requests with single libcurl handle

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 8 Sep 2017 13:39:14 +0200 (CEST)

On Fri, 8 Sep 2017, ViDyAnAnD NiLLe via curl-library wrote:

> After going through curl multi interface document, it looks like we can send
> concurrent request using multiple easy handles in single thread.

Exactly.

> I want to simulate async requests the way browser sends.
>
> e.g When we hit www.google.com it may send multiple async requests to
> google.com server to load images, java scripts etc. I want to do similar way
> with single curl handle, is that possible?

Sure, each transfer you want to do is setup in an easy handle, you add those
easy handles to the multi handle and off you go.

It can do any number of transfers in parallel and you can add new and remove
existing transfers at any time.

> As per examples given i need to create easy handle for every request and
> then do multi execute. Can't it be done on single handle?

A single multi handle, yes. Each individual transfer that runs has to be setup
separately in its own corresponding easy handle.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-09-08