Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a maximum timeout #154

Open
chuyskywalker opened this issue Jun 29, 2023 · 0 comments
Open

Setting a maximum timeout #154

chuyskywalker opened this issue Jun 29, 2023 · 0 comments

Comments

@chuyskywalker
Copy link

I've poked around the code, example ino files, issues, and arduino forums for this, but I can't seem to find a reliable way to set a timeout for the HTTP request.

My code, essentially, boils down to this:

void send_data() {

  unsigned long millistart = millis();
  String url = "id=somedatahere";

  // new client each time
  HttpClient http(client, traccar_server, traccar_port);

  // start for the / url, and set some timeouts
  http.beginRequest();
  http.setTimeout(5000);
  http.setHttpResponseTimeout(5000);  
  int err = http.post("/", "application/x-www-form-urlencoded", url);
  http.endRequest();

  SerialMon.println("> post done (" + String((millis() - millistart)/1000.0,2) + "s)");
}

(The above is paraphrased and not necessarily working code, the full code is available here but has all kinds of other GPS/data/modem stuff going on as well.)

Yet I routinely see the "post done" showing times well in excess of 10 seconds and sometimes even up to 75 seconds or so (which is a real fishy number, like a 60s timeout on top of a 15s from something else).

Setup info:

  • Device: LILYGO T-SIM7000G ESP32-WROVER-B
  • Arduino IDE 2.1.0
  • ArduinoHttpClient 0.4.0

How can I set a overall timeout for a given HTTP request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant