On Wed, Aug 19, 2009 at 12:44 PM, tatebn <[email protected]> wrote:

>
> I was wondering how I would go about adding some sort of retry logic.
> As in, if it can't connect to host, sleep for 5 seconds and try again,
> up to 3 times.
>
> I understand the loop structure, but if it can't connect to host it
> throws an error and that seems to be that.  So how would I not throw
> that error?
>
> I have a catch block for runtime errors so I suppose I could do it
> there, but how would I pick up program execution from where I left
> off?
>

// set options

bool succeded = false;
for (unsigned i = 0; i < 3 && !succeded)
{
   try{
    perform();
   succeded = true;
   }
  catch(...)
{
   cerr << "failed" << endl;
   }

}




>
> Thanks
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"curlpp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/curlpp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to