Open abhir24 opened 7 years ago
Also posted on the forum: http://forum.arduino.cc/index.php?topic=481200.msg3299310#msg3299310
Was this ever solved? I am having the same problem. It works for the first .get(), but for second .get() and all subsequent .get()'s, I get -2.
I solved this by callin http.stop() after each call.
@c0dehunter Hi, mind explaining more about how did you call http.stop()? Because I can't find a variable named http in your code. I'm facing the same issue here. Would appreciate any help you can offer 🙏🏻
@paulchrisycj late to the party here, but I believe he meant calling HttpClient stop() which in the above code would be: client1.stop()
. I just ran into this same issue and this fix seemed to work!
I solved this by callin http.stop() after each call.
The httpClient.stop()
should be part of the documentation and examples too. Took me a decent hour to figure this out for myself.
Actually I have solved this issue by calling httpClient.connectionKeepAlive(); in setup().
Basically my server overloaded and requests after the overloading caused this error.
By using httpClient.connectionKeepAlive(); to keep the connection alive, httpClient is just making a new request using the connection that has already been made when you set the httpClient object up.
Actually I have solved this issue by calling httpClient.connectionKeepAlive(); in setup().
Basically my server overloaded and requests after the overloading caused this error.
By using httpClient.connectionKeepAlive(); to keep the connection alive, httpClient is just making a new request using the connection that has already been made when you set the httpClient object up.
Unsure if anyone else is still facing the same issue, but if there is someone, do verify if this works. Thanks.
@paulchrisycj persistent vs non-persistent connections should be used depending on the use case. Unless you have a specific reason to keep the connection open, you probably should just close it.
Well based on the use case in this issue thread, the POST Request is written inside the loop() function. Since it will be making more than 1 request, it should be a persistent connection.
The response I am getting is status code: -2 Response:
I am new to github, I hope I am using it right. Sorry otherwise.