cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Fwd: Re: [cURLpp] cURLpp::Cleanup]

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Wed, 25 Jan 2006 09:28:21 -0500

Sorry for my last mail, I fowarded the wrong message. You're not stupid,
I am! :P

This is the real question.

attached mail follows:


Thanks for the help! One more question, I am trying to do something like
this:

cURLpp::Easy requestHandle;

main()
{
...

  // use requestHandle.setopt( ) to set up for HTTP POST
  // set up a writeData function for handling responses from server

    // perform POST
  request.perform();

  // For my application, I expect to get several separate replies from
  // the server although I only sent one POST

  // need to use setopt( ) so that I can get every response. I know
  // I got the first response from
  // the previous call to perform( ), but now I need to get the rest of
  // the responses.
  // I'M NOT SURE HOW TO USE SETOPT TO DO THIS!!

  // Assume I parse each response as I get them so that I
  // know when I'm done (so I can set 'done')
  while( !done )
  {
      request.perform();

     // parse response body
  }
...
}

So I need to use setopt to make it so I can simply 'get' http messages until
I'm done getting them. I assume the 'perform' in my while loop would get
one message for each iteration. Is there an option that just tells curlpp
to try to find an incoming message...if so, is it blocking or non-blocking
(seems like this should be configurable)?

Thanks,
John

On 1/24/06, Jean-Philippe Barrette-LaPierre <
jean-philippe.barrette-lapierre_at_savoirfairelinux.com> wrote:
>
> Le Janvier 23, 2006 06:33 PM, John Burnette a écrit:
> > Hi,
> >
> > I just started using cURLpp and so far it has been wonderful. I was
> > looking through the sample programs and came across the line:
> >
> > cURLpp::Cleanup myCleanup
> >
> > in all of the apps. What exactly does this do or what does it clean up?
> > Does it delete my handle? Where does this go in my code if I plan to
> reuse
> > the same handle during the lifetime of my program?
>
> cURLpp::Cleanup is just an utility class that does cURLpp::initialize()
> within
> the constructor and cURLpp::terminate() within the destructor. It's nice
> to
> use if you know the cURLpp's lifetime within your application, but you can
> just call the initialize function and the terminate function when you need
> to. You should take a look at curl_easy_init's and curl_easy_cleanup's
> doc.
>
> Here's the doc of cURLpp::initialize:
>
> /**
> * This function takes care of initializing cURLpp ( also libcURL).
> * If you want to cleanup cURL before your application quits just
> * call cURLpp::terminate(). This function should only be called
> * once (no matter how many threads or libcurl sessions that'll
> * be used) by every application that uses libcurl, it will throw a
> * logic_error if you call it twice.
> *
> * NOTE: you cannot call this function twice without first
> * terminating it first. it will throw a logic_error if you do this.
> */
>
>
> --
> Jean-Philippe Barrette-LaPierre
> Savoir-Faire Linux
> (514) 276-5468 #251
> _______________________________________________
> cURLpp mailing list
> cURLpp_at_rrette.com
> http://www.rrette.com/mailman/listinfo/curlpp
>

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2006-01-25