cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_perform - how to know if data is entirely sent.

From: Alan Wolfe <alan.wolfe_at_gmail.com>
Date: Thu, 19 May 2011 22:09:44 -0700

hrm... i'm sure there's a way but i don't know how.

I'm curious though, why do you want to wait?

On Thu, May 19, 2011 at 9:59 PM, swathi upadhyaya <swathih9_at_gmail.com> wrote:
> Thanks for the quick response.
>
> still_running will drop to 0 only after you get http - response[ie
> request complete]. I want to wait only till request is sent to server.
> Will read response later in receive function.
>
> For ex. I am requesting for  URL cnn.com
> still-running  will drop to 0 only after the whole cnn.com  page
> contents are displayed.
>
> Is there a way to determine when the request is completely transferred.
>
> Thanks
>
>
> On 5/20/11, Alan Wolfe <alan.wolfe_at_gmail.com> wrote:
>> the still_running int will drop to 0 when the request is complete.
>>
>> just have a loop something like this...
>>
>> while(still_running > 0)
>> {
>>   Sleep(50); //yield the processor
>>   //dont forget to pump libcurl in this loop (i forget the function name)
>> }
>>
>> or of course, you can do work inside the while loop if you have work to do
>>
>> On Thu, May 19, 2011 at 9:23 PM, swathi upadhyaya <swathih9_at_gmail.com>
>> wrote:
>>> Hi,
>>>
>>>
>>> I have a send function where i would be posting HTTP request. I am using
>>> curl_multi_perform to send the request .
>>>
>>> sendhttpRequest()  {
>>>
>>> res = curl_multi_perform(curl);
>>>
>>> while(still_running) {
>>>
>>> .....
>>>
>>> if(dataAvailable()) {
>>>
>>> curl_multi_perform<http://curl.haxx.se/libcurl/c/curl_multi_perform.html>(curl,
>>> &still_running); . } } .
>>> return (SendStatus);   // This function should return only after entire
>>> data
>>> is sent .
>>>
>>> }
>>>
>>> But this approach will block till the http response is received.
>>>
>>> I tried curl_multi_info_read, but this also gives CURLMSG_DONE only when
>>> HTTP-Response is done.
>>>
>>> I just want to make sure that data is entirely sent on socket before
>>> comming
>>> out of send function,. but donot want to wait for HTTP response. Is there
>>> any way to acheive this?
>>>
>>>
>>> Thanks
>>>
>>> -------------------------------------------------------------------
>>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>>> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>>>
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-20