int clients()
{
int ans=0;
struct station_info *stat_info;
stat_info=wifi_softap_get_station_info();
while (stat_info != NULL) {
ans++;
stat_info = STAILQ_NEXT(stat_info, next);
}
return ans;
}
wifi_set_event_handler_cb
And to count up and down in your callback.
I've definitely always seen EVENT_SOFTAPMODE_STACONNECTED on connection of a station but I've not checked that you always get the disconnect reliably. (You might, I've not checked.)
@vanjo9800 your code looks OK, but looks like it's going to leak memory. The SDK docs show two ways around this:
- either os_free() each station after you've looked at it
- or at the end of your loop call wifi_softap_free_station_info()
esp8266 otb-iot documentation - https://otb-iot.readthedocs.io/
esp8266 related blog - http://www.packom.net/
I made it with the handler of connecting and disconnecting however I experience the same problem I have with both the station_info and the with wifi_station_numbers. The three continue to mark that a device is connected for a while after it has disconnected. I use that ESP8266 in order to see when an another ESP8266 has connected to it. Only with both ESPs there is that problem. With a computer and Android phone everything works perfectly.
Do you know where the problem can be?
Thank you in advance!!!