Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to make cURL reconnect


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 3DModelerMan   Members   -  Reputation: 994

Like
0Likes
Like

Posted 27 October 2012 - 10:01 AM

Does anyone know how to do this? I'm using the library in C++ and I'm trying to get it to reconnect if the internet connection is lost. I've been testing by disabling the network adapter in windows, starting my game, trying to connect (and obviously failing) and then enabling the network adapter and trying to connect again. All of this while running the game the whole time. The problem is that cURL returns error code 60 when I try to run perform. Even though an internet connection is available now. I'm usig the "easy" set pf functions.

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5162

Like
2Likes
Like

Posted 27 October 2012 - 03:56 PM

If you're using HTTP connections, then HTTP does not have "reconnect." You have to create a new HTTP request and start that.
enum Bool { True, False, FileNotFound };

#3 3DModelerMan   Members   -  Reputation: 994

Like
0Likes
Like

Posted 27 October 2012 - 05:14 PM

Do you mean create new curl handle? I only have one handle that I've been storing and reusing. Am I supposed to be creating a new one for each request?

#4 hplus0603   Moderators   -  Reputation: 5162

Like
2Likes
Like

Posted 27 October 2012 - 08:23 PM

If I remember right, once a connection is dead, you have to create a new one. So, try that. It's been a while since I used libcurl, so the details are fuzzy.
The HTTP protocol (version 1.1) allows a single TCP connection to be re-used for multiple HTTP requests, but once that TCP connection is dead, you cannot re-use it.
enum Bool { True, False, FileNotFound };

#5 3DModelerMan   Members   -  Reputation: 994

Like
0Likes
Like

Posted 28 October 2012 - 08:25 AM

Thanks. It works now.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS