gpt4 book ai didi

android - Wi-Fi Direct 和 "normal"Wi-Fi - 不同的 MAC?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:52:39 27 4
gpt4 key购买 nike

我目前正在尝试通过 Wi-Fi Direct 连接两部知道彼此 MAC 地址的手机,但偶然发现了以下问题:我从

收到的 MAC 地址
    WifiManager wifiMan = (WifiManager) this
.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInf = wifiMan.getConnectionInfo();
MAC_ADDRESS = wifiInf.getMacAddress();

与我在发现和请求对等点时从 WifiP2pManager 收到的略有不同。示例:a0:xx:xx:... 变为 a2:xx:xx....有谁知道为什么?我没有找到任何方法来获取“Wi-Fi Direct MAC 地址”,而且我认为 MAC 地址应该是唯一的,并且它是处理两者(普通 Wi-Fi 和 P2P/Direct)的同一个 Wi-Fi 模块.这很奇怪..我应该怎么办?对于我得到的两个设备 (Galaxy Nexus),MAC 地址总是只有前两个字符不同——我应该简单地丢弃它们吗?遇到问题(两台设备仅 MAC 地址第一部分不同)的概率是否太高?

谢谢。

最佳答案

阅读 MAC address在维基百科上。

Addresses can either be universally administered addresses or locally administered addresses.

Universally administered and locally administered addresses are distinguished by setting the second-least-significant bit of the most significant byte of the address. This bit is also referred to as the U/L bit, short for Universal/Local, which identifies how the address is administered. If the bit is 0, the address is universally administered. If it is 1, the address is locally administered.

MAC 48 Address

由于 Wi-Fi Direct 只是 MAC 之上的另一个堆栈,您还应该检查该位对它的含义。我找到了一些 mail discussion阐明这一点。显然下面的引用来自 WFA 规范。

The P2P Device shall assign a P2P Interface Address, corresponding to the format as described in §7.1.3.3.1 of IEEE Std 802.11‑2007 1, which is used to communicate with the P2P Group Owner or Clients within a P2P Group. A P2P Interface Address is not required to be globally unique and may be locally administered. A P2P Interface Address may be the same as the P2P Device Address provided the requirements for P2P Interface Address in this clause are satisfied.

所以我认为这个问题的答案是,您不应该从 WifiManager 获取 MAC 地址并将其用于 Wi-Fi P2P 连接。

关于android - Wi-Fi Direct 和 "normal"Wi-Fi - 不同的 MAC?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10968951/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com