Chat freely about anything...

User avatar
By Barnabybear
#44550 Hi, just a quick one as I have to be up early in the morning.
I've been looking into this and it appears that in some situations after 5 minutes of inactivity the ESP requests confirmation that it is still connected to a WiFi network (tries to renew its lease). It appears that dependant on the response received from the AP / router the ESP still believes it is connected but the AP / router stops sending data to the ESP. Changing the lease time on the AP / router to anything less than 5 minutes seems to cure this, as it never has more than 5 minutes of inactivity, but is not really the answer. Whilst I haven’t done enough research to understand what the difference is, it appears to be something to do with whether it is a level 2 or 3 something (its late and I'm not getting my notes out) on the AP / router.
Still working on this – if any of this makes sense to you and you get there first please post the answer and you will save me lots of time. Happy to team up to solve this if you know about AP / router stuff.
User avatar
By bumxu
#44746 Hi,

I'm having the same problem.
My platform is NodeMCU 0.9 and I'm using Espressif SDK 1.5.2.

It seems a particular problem with some APs/routers; with my home router (Vodafone Standard) ESP listens for around a minute, but with my smartphone sharing wifi I had no problems receiving messages for hours.

I could apply the Toshi's solution in the SDK separating the lines, with them together it doesn't work for me:

Code: Select all  wifi_set_opmode_current(STATIONAP_MODE); // <------------
  wifi_station_set_reconnect_policy(true);
  wifi_set_sleep_type(NONE_SLEEP_T);

  struct station_config setup;
  os_memset(&setup, 0, sizeof(struct station_config));
  os_sprintf(setup.ssid, "%s", ssid); os_sprintf(setup.password, "%s", pass);

  wifi_station_set_config_current(&setup);
  wifi_set_opmode_current(STATION_MODE); // <------------

  [...connect and verifications...]


Another thing that works for me at first was send an UDP message (1 byte enough) to router every 5~10 seconds, silly, but it kept listening (most times). :?

An official solution could be very good.