-->
Page 3 of 7

Re: SoftAP - getting a list of connected clients

PostPosted: Wed Mar 09, 2016 3:23 am
by Phil colbert
This code nearly works for me.....

If theres only one station connected then stat_info comes back as null...

If theres more than one it comes back with the info, any ideas ?


###########

Total connected_client are = 2
client= 1 ip address is = 192.168.4.2 with mac adress is = 106675E0DB9

############

Total connected_client are = 3
client= 1 ip address is = 192.168.4.2 with mac adress is = 106675E0DB9
client= 2 ip address is = 192.168.4.3 with mac adress is = 024D272BC71

##############

Thanks

Phi..

Re: SoftAP - getting a list of connected clients

PostPosted: Wed Mar 09, 2016 9:35 am
by martinayotte
Are you sure that you didn't introduce a bug in the code ?
Because the following code work fine for me with only 1 client connected :

Code: Select all  struct station_info *stat_info;
  stat_info = wifi_softap_get_station_info();
  uint8_t client_count = wifi_softap_get_station_num();
  String str = "Number of clients = ";
  str += String(client_count);
  str += "\r\nList of clients : \r\n";
  int i = 1;
  while (stat_info != NULL) {
    str += "Station #";
    str += String(i);
    str += " : ";
    str += String(stat_info->bssid[0], HEX);
    str += ":";
    str += String(stat_info->bssid[1], HEX);
    str += ":";
    str += String(stat_info->bssid[2], HEX);
    str += ":";
    str += String(stat_info->bssid[3], HEX);
    str += ":";
    str += String(stat_info->bssid[4], HEX);
    str += ":";
    str += String(stat_info->bssid[5], HEX);
    str += "\r\n";
    i++;
    stat_info = STAILQ_NEXT(stat_info, next);
    }
  Serial.println(str);

Re: SoftAP - getting a list of connected clients

PostPosted: Sun Mar 13, 2016 2:20 pm
by Phil colbert
Thanks for the reply, doesnt work for me , will look into it, rather strange !

Re: SoftAP - getting a list of connected clients

PostPosted: Sun Mar 13, 2016 2:46 pm
by martinayotte
Maybe your Arduino ESP framework is too old ...