Page 1 of 1

HttpClient.get() fails with -1

Posted: Mon May 18, 2020 1:33 pm
by Mike1997
I'm programming my ESP32 with the ArduinoIDE and have a problem with HTTP GET. What I'm doing:

- the ESP32 connects as WiFi client to an existing WiFi network using a static, fixed IP

- a webserver is started which provides a webpage for OTA firmware update -> this works, the webpage is accessible via the static IP

- using HttpClient I try to GET an other, remote webserver, but this fails

This is the code I'm using for the HTTP GET call:

Code: Select all

static WiFiClient wifi;

HttpClient wlanHttp=HttpClient(wifi,"my.server.tld");
wlanHttp.get("/setpos.php?id=DEADBEEF"); // -> this fails with error code -1
wlanHttp.responseStatusCode(); // follow-up error -1
wlanHttp.stop();
Any idea what goes wrong here?

Thanks!

Re: HttpClient.get() fails with -1

Posted: Tue May 19, 2020 2:37 am
by chegewara