cURL Mailing List Monthly Index Single Mail
curl-library Mailing List Archives
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 threads.
> I need to perform a POST operation with XML content using a multi threaded
> 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 one
> operation. But how do we make the write operation in one thread and read
> operation in another. Any help is greatly appreciated.
Simple: you don't. libcurl, by definition, performs a single transfer within
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 data
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 to
the other thread from within the write callback function. That is essentially
the same as the first method just done more frequently (every few KB instead
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 write
into the same buffer at the same time.
http://www.MoveAnnouncer.com The web change of address service
Let webmasters know that your web site has moved
Received on 2009-01-31
These mail archives are generated by hypermail.
Page updated November 12, 2010.
File upload with ASP.NET
web site info