简体   繁体   中英

While connected to a Wi-Fi network, get all of its access points

In my database, I'm looking for a primary key to save settings for a Wi-Fi network. Most people point to SSID+BSSID, but the problem with that is networks with multiple access points. After further investigation, the best solution I've found so far is having multiple database entries with SSID+BSSID linked together if they represent the same network.

Now the question becomes, is it possible to retrieve a list of all access points while you are connected to one of them ? Either that or a simpler list of all BSSID associated with the network you are connected to.

Either Swift or Objective-C is perfectly fine.

I couldn't find a way to retrieve all access points of a network in iOS.

For anyone curious, I went with storing SSID+BSSID as primary key and public IP as another field.

If the entry doesn't exist, I add it and check for other entries with the same IP and link them together. If the entry does exist, I check if the IP hasn't changed since last time, since public IP can be dynamic. If it has, I update all entries with the old IP to the new IP.

It's still not a perfect solution. It doesn't cover the case where you go to a new access point of a network and the public IP for that network has changed, although it does fix itself to some extent if you go back to the first access point. Also, in general, places that have multiple access points also tend to have static IPs, so this case may be very situational.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM