- Wed Mar 16, 2016 1:19 pm
#43319
Phil colbert wrote: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 ?
I suspect that "wifi_softap_get_station_info" is updated a short time after "wifi_softap_get_station_num".
So that if you call "wifi_softap_get_station_info" immediately after "wifi_softap_get_station_num", you don't get the correct results because whatever internal connection table hasn't been updated yet.
Perhaps "wifi_softap_get_station_num" is updated immediately after connection, but "wifi_softap_get_station_info" isn't updated until after the IP address, subnet mask, etc. is sent to the client a fraction of a second or so later.
I added a 1 second delay between the call to "wifi_softap_get_station_num" and "wifi_softap_get_station_info" and I get the correct results. I know it's kind of hackish, but maybe someone has a more elegant solution.