I use:
extern "C" {
#include "user_interface.h"
}
//------------------------------------------------------------------------------------------------------
Serial.println("-------------Connected Clients List-----------------------");
Serial.print(wifi_softap_get_station_num()); Serial.println(" clients.");
struct station_info *station_list = wifi_softap_get_station_info();
while (station_list != NULL) {
char station_mac[18] = {0}; sprintf(station_mac, "%02X:%02X:%02X:%02X:%02X:%02X", MAC2STR(station_list->bssid));
String station_ip = IPAddress((&station_list->ip)->addr).toString();
Serial.print(station_mac); Serial.print(" "); Serial.println(station_ip);
station_list = STAILQ_NEXT(station_list, next);
}
wifi_softap_free_station_info();
Serial.println();
//------------------------------------------------------------------------------------------------------
This works mostly fine for me, but has a problem!
If connect android device, serial print: connected station numbers and IPs.
When disconnect the info gone (normal).
If connect other NodeMCU (as station), serial print: connected station numbers and IPs.,
but when disconnect the info stay on serial print!?
Please for some help.
Regards