问题描述
现在的问题是如下 - 有一个单一的SSID的大学校园广泛的无线连接,说:校园无线上网。用户自由地漫游在校园里,与接入点之间平时的切换发生。我的问题是,有没有在网络协议栈的任何一层,允许的客户的识别(任何唯一的标识符是罚款)的特定的接入点他们所连接,而不是简单的事实,任何信息它们连接到校园无线网络?
The problem is as follows - there's a university campus wide wifi connection with a single SSID, say "campus-wifi". The user freely roams around campus, and the usual hand-off between access points occurs. My question is, is there any information at any layer of the network stack that allows the client to identify (any unique identifier is fine) the specific access point they're connected to, rather than simply the fact that they are connected to "campus-wifi"?
如果是相关的,我希望能够从移动设备上做到这一点(安卓/ iOS的为主)。
If it's relevant, I'd like to be able to do this from mobile devices (android/iOS primarily).
推荐答案
可以让你连接到接入点的BSSID。是这样的:
You can get the BSSID of the access point you are connected to. Something like:
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo();
String BSSID = info.getBSSID();
不是100%,你会得到什么回来的BSSID,因为我从来没有使用过 - 但它应该唯一标识基站 - 维基百科似乎表明,你会得到AP的MAC(近底部):
Not 100% what you'll get back with the BSSID since I've never used it -- but it should uniquely ID the base station -- Wikipedia seems to indicate that you'll get the MAC of the AP (near the bottom):
http://en.wikipedia.org/wiki/Service_set_(802.11_network)#Basic_service_set_identifier_.28BSSID.29
- 丹
编辑:
根据Android的文档,它是MAC地址:
According to the Android docs, it is the MAC address:
http://developer.android.com/reference/android/net/wifi/WifiInfo.html
这篇关于方式为客户端来识别特定的接入点它被连接到在单一的SSID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!