Is there any timeout at "client.available()"? In my opninion not. It's stuck in the while loop if you move out of the wifi range. Is there a way to get a timeout?
unsigned int HttpClient::get(String &url) {
begin("curl");
addParameter(url);
return run();
}
Rewrite HttpClient by use directly Process.
curl -h
...
--connect-timeout SECONDS Maximum time allowed for connection
...
-m, --max-time SECONDS Maximum time allowed for the transfer
/*
Running process using Process class.
This sketch demonstrate how to run linux processes
using an Arduino Yún.
created 5 Jun 2013
by Cristian Maglie
This example code is in the public domain.
http://arduino.cc/en/Tutorial/Process
*/
#include <Process.h>
void setup() {
Bridge.begin();
// Initialize Serial
Serial.begin(9600);
// Wait until a Serial Monitor is connected.
while (!Serial);
}
void loop() {
// Do nothing here.
Process p;
p.begin("curl");
p.addParameter("--connect-timeout");
p.addParameter("10");
p.addParameter("-m");
p.addParameter("60");
p.addParameter("http://arduino.cc/asciilogo.txt");
p.run();
// Print command output on the Serial.
// A process output can be read with the stream methods
while (p.available() > 0) {
char c = p.read();
Serial.print(c);
}
// Ensure the last bit of data is sent.
Serial.flush();
delay(5000);
}
I don't think that's what i meant. I mean, if a timeout occurs, how can i get a notification
that it had been that way ? I need to post certain interrup counts with curl but when they
are not posted alright the interrupt count doesn't need to be reset to 0, he'll just retry next
time and adds the count then.