cURL / Mailing Lists / curl-library / Single Mail

curl-library

Use read/write with same curl handle.

From: Nilesh <nilesh_at_kenati.com>
Date: Tue, 28 Feb 2006 18:13:07 +0530

Hi,

Can I use same curl handle to send and receive data ?

I am facing problem when I try with single handle for both outgoing post
data and incoming data.

I have set following options for handle ( In addition to required URL,
connection options ofcource),

curl_easy_setopt(*out_handle, CURLOPT_POSTFIELDS, out_buffer);
curl_easy_setopt(*out_handle, CURLOPT_POSTFIELDSIZE, strlen(out_buffer));

-- above two are to send post data through out_handle

curl_easy_setopt(*out_handle, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(*out_handle, CURLOPT_WRITEDATA, (void *)in_packet);

-- These two are save incoming data to in_packet structure.

Adding this as part of multi handle as follows
curl_multi_add_handle(*multi_handle, *out_handle);

-- Using multi_perform and select to check if data is available to
send/recieve.

Problem is that flow is coming to default case of switch, which tells
some data has come.
While DEBUGIng I am getting HTTP header details which I have received
with vaid content length, but it doesn't display data.
 I have also put debug printf in write_callback function to printf
received data, which doesn't really get printed.

What can be possible reason ?

If any more details needed plz let me know.

Thanks,
Nilesh
Received on 2006-02-28