curl / Mailing Lists / curl-library / Single Mail


Re: Asynchronous ordered sends

From: Daniel Stenberg <>
Date: Wed, 22 Mar 2017 22:45:23 +0100 (CET)

On Tue, 21 Mar 2017, Emir Kamber wrote:

> I have successfully implemented async sends via 'multi-functionality', but I
> have a problem where messages are sent in no particular order. So, when I
> send 3 messages, I get this on the wire: MSG3, MSG1, MSG2.
> I need to send messages in the order that I add them via
> 'curl_multi_add_handle', so that I get MSG1, MSG2, MSG3 on the wire. In
> essence I just need to send an X number of messages in sequence as quickly
> as possible, and then will worry about reading the response from the server.

The multi API handles many transfers in parallel, but it will do them all
independent and as fast as possible. If you add three easy handles, libcurl
will try to perform those three transfers as quickly as it can.

If you need the transfers done serially, you need to wait until transfer one
is done before you add the easy handle for transfer two and so on.

Received on 2017-03-22