Hi all!
I often get -1 as result of a simple http get.
After fiddling a bit I thought I had the necessity to change the timeout value in httpclient library or all my requests will return -1 (very long requests).
I have found this row in httpclient.ccp code that seems to be the key of my current issue:
static const uint16_t TIMEOUT = 5000; // Allow maximum 5s between data packets.
Is it possible to change this timeout value in http://build.particle.io ?
Thanks and happy hacking
That was an easy one, I excuse myself for such a silly question.
In case anybody else is struggling with the same issue it is sufficient to specify a different value of TIMEOUT before your setup()
static const uint16_t TIMEOUT = 15000; // Allow maximum 15s between data packets.
This way, even not changing the library the variable gets the correct value before starting the loop() section.
ltpitt
July 4, 2016, 11:53am
3
Sadly this was not enough to solve my issue
I keep on getting -1 as result from HttpClient, even changing the timeout value.
Main thing is that this is not happening consistently…
As a workaround I am now handling cases when HttpClient’s result is -1 but that is, clearly, not fantastic.
Any suggestion / idea?
Hi @ltpitt ,
Im having the same problem as yours. Did you find the solution?
Thankss!
bko
September 13, 2016, 7:43pm
5
Please see the other thread where I answered your question:
This is not a host name. You should leave the hostname NULL and set the IP address with something like:
IPAddress localserver(192,168,0,1);
request.ip = localserver;
1 Like