ESP8266 randomly won't connect to webserver
Posted: Wed Nov 02, 2016 8:57 am
Hi,
I am using GET on a webserver to upload some data every 20 seconds. For some reason it randomly won't connect (even though wifi remains connected, i can ping the module). I have the module about 1metre away from the modem, so signal strength is good. I have turned on debug, and it comes up with :err -8 (what does this mean? Where can i find the documentation for the debug?)
I have tried another wifi and internet connection, same problem. Sometimes it goes for 1 hour then the problems start, other times it goes for 5-10 minutes then the problems start. It's very random.
Here is the sample code (it's in a function that is called every 20 seconds):
When it works fine, it displays the following output:
:ref 1
:wr
:sent 131
:ww
:rn 1452
:rch 1452, 598
:rcl
:abort
:ur 1
:del
Wifi Status 3
When it fails, it displays the following:
:err -8
ERROR CONNECTING - Wifi Status 3
Wifi Status 3
Where can I find more about what :err -8 is or means?
I am using GET on a webserver to upload some data every 20 seconds. For some reason it randomly won't connect (even though wifi remains connected, i can ping the module). I have the module about 1metre away from the modem, so signal strength is good. I have turned on debug, and it comes up with :err -8 (what does this mean? Where can i find the documentation for the debug?)
I have tried another wifi and internet connection, same problem. Sometimes it goes for 1 hour then the problems start, other times it goes for 5-10 minutes then the problems start. It's very random.
Here is the sample code (it's in a function that is called every 20 seconds):
Code: Select all
WiFiClient client;
if (client.connect(server_ip_address,80))
{
String text_to_send = "GET http://mywebsiteURL.com/index.php?uptime_ms=";
text_to_send +=millis();
text_to_send +="&heap=";
text_to_send +=ESP.getFreeHeap();
text_to_send +="&RSSI=";
text_to_send +=WiFi.RSSI();
text_to_send +=" HTTP/1.1\r\nHost: mywebsiteURL.com\r\nConnection: close\r\n\r\n";
client.print(text_to_send);
}
else
{
DEBUG_MSG("ERROR CONNECTING - Wifi Status %d\n", WiFi.status());
}
client.stop();
DEBUG_MSG("Wifi Status %d\n", WiFi.status());
When it works fine, it displays the following output:
:ref 1
:wr
:sent 131
:ww
:rn 1452
:rch 1452, 598
:rcl
:abort
:ur 1
:del
Wifi Status 3
When it fails, it displays the following:
:err -8
ERROR CONNECTING - Wifi Status 3
Wifi Status 3
Where can I find more about what :err -8 is or means?