-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Web Server Stops responding after a while #54
Comments
Can you share some code? I have not experienced such a thing before |
Can you ping the ESP? I've had a similar problem but apparently was at ARP level and I resolved with this code that I found elsewhere: `extern "C" { void forceARP() { while (netif) Within the loop the forceARP(); is cyclically called:
one_second_flag is set by Ticker (see Ticker.h) every second. |
Hi Claudio, Cheers, |
Hi Claudio, https://github.com/esp8266/Arduino/blob/master/libraries/Ticker/Ticker.h Do you happen to know the new way of doing it? Cheers, |
Anyways thats not a problem delay ill figure out. but when calling forceARP its crashing `#include <ArduinoJson.h> extern "C" { void forceARP() { void setup(void) { void loop(void) { It crashed saying ` ctx: cont
ets Jan 8 2013,rst cause:2, boot mode:(1,6) Port closed ets Jan 8 2013,rst cause:4, boot mode:(1,6) wdt reset` |
Hi Claudio,
Thanks for the reference claudio I will try to put it into test and see if it works. Cheers, |
Hi Akash. Sorry for my confusing post. It's a bad thing to write in the dead of night :) bool one_second_flag = false;
// set the one second flag, this function is called every 1 second
void setTickflag() {
one_second_flag = true;
}
extern "C" {
extern char *netif_list;
uint8_t etharp_request(char *, char *);
}
void forceARP() {
char *netif = netif_list;
while (netif)
{
etharp_request((netif), (netif+4));
netif = *((char **) netif);
}
}
void setup
{
TimeTicker.attach(1, setTickflag); // will call setTickflag every 1 second
}
void loop()
{
if(one_second_flag) {
one_second_flag = false;
forceARP();
}
} The use of a global flag set by a function that in turn is called by Ticker is to avoid the code within the loop function be blocked while waiting for the delay() to expire. Greetings, |
@thehellmaker this loop should be totally fine: void loop(void) {
delay(1000);
forceARP();
} You can use this tool to decode the stack trace that you are getting, to get a better idea where the code crashes. |
Thanks a lot @me-no-dev for the tool link. Also this wnt work as it will block the mcu and the responses will all be 1s delayed and not immediate Ticker approach works better because there is no blocking. Tested this. There have been no arp issue till now after this fix so. Hence resolving this. Will reopen in case there are more issues. |
@thehellmaker |
Ok. I didnt know that. Thanks @me-no-dev .Also I just checked I am facing the problem again. From Chrome browser the device is responding but from android device its not able to connect to it. |
Tried ping from my tablet, my phone and Laptop.
|
can we move this discussion to https://github.com/esp8266/Arduino since it's not really related to the web server |
Surely @me-no-dev. Makes sense |
I had the same issue, now it's reduced after I started using edge explorer instead of chrome, don't know any reason, but it worked for me |
that's right |
Hi All,
ESP async webserver becomes unavailable after sometime intermittently where it says
Connection to http://192.168.1.4:80 refused
org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.4:80 refused
The same happens from the web browser and then it starts working randomly. Checking the logs of the ESP device itself there is no crash.
Am i missing something in the setup of the server which can keep it alive all the time.
Cheers,
Akash A
The text was updated successfully, but these errors were encountered: