cURL / Mailing Lists / curl-library / Single Mail


RE: CURL POST operation using read and write threads

From: Senthil Raja Velu <>
Date: Mon, 2 Feb 2009 11:25:57 -0800

Thanks for the pointers Dan!


-----Original Message-----
[] On Behalf Of Dan Fandrich
Sent: Friday, January 30, 2009 7:45 PM
Subject: Re: CURL POST operation using read and write threads

On Fri, Jan 30, 2009 at 07:02:23PM -0800, Senthil Raja Velu wrote:
> I am newbie to curl and trying to figure out how to use it with multi
> I need to perform a POST operation with XML content using a multi
> program. I need to perform the request operation in one thread and
read the
> response in another thread. I see the curl_easy_perform does it all on
> operation. But how do we make the write operation in one thread and
> operation in another. Any help is greatly appreciated.

Simple: you don't. libcurl, by definition, performs a single transfer
a single thread. If you need access to the results from another thread,
you can grant that access in a few ways. One is to simply download the
entirely into memory or disk and pass a pointer or file name to the
other thread. Another is to pass each chunk of data as it is received
the other thread from within the write callback function. That is
the same as the first method just done more frequently (every few KB
of once per URL). Either way, you'll of course have to use some kind
of mutual exclusion method to make sure that both threads don't try to
into the same buffer at the same time.

>>> Dan

--              The web change of address
          Let webmasters know that your web site has moved
Received on 2009-02-02