gpt4 book ai didi

android - Android 上的 Wifi 感知和 Wifi P2P 之间的区别?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:17:21 43 4
gpt4 key购买 nike

WiFi 感知和 WiFi P2P 技术之间的主要区别是什么?

使用 WiFi P2P,您可以在两个或多个附近的设备之间建立连接,而无需公共(public)网络。但是 android 文档规范也说明了这一点

Wi-Fi Aware capabilities enable devices running Android 8.0 (API level 26) and higher to discover and connect directly to each other without any other type of connectivity between them.

它们有什么区别?

最佳答案

根据 Android 文档,使用 Wi-Fi Aware,您可以在设备之间在服务发现阶段发送数据(仅限轻量级!最多 255 字节),并且在需要时,您可以打开一个设备之间的连接以发送更大的数据。使用 Wi-Fi 点对点,您必须先执行某种身份验证,然后打开套接字,然后才能在设备之间发送数据。

以下是 Wi-Fi aware overview 的部分内容我从哪里得到这些信息:

The Wi-Fi Aware APIs let apps perform the following operations:

  • Discover other devices: [...] After the subscriber discovers a publisher, the subscriber can either send a short message or establish a network connection with the discovered device.
  • Create a network connection: After two devices have discovered each other [...] they can create a bi-directional Wi-Fi Aware network connection without an access point.

Note: Messages are generally used for lightweight messaging, as they might not be delivered (or be delivered out-of-order or more than once) and are limited to about 255 bytes in length.

此外,借助 Wi-Fi Aware,开发人员可以在 DiscoverySession 类的方法 createNetworkSpecifierOpen()createNetworkSpecifierPassphrase() 之间进行选择分别在设备之间打开未加密或加密的连接。

对于 Wi-Fi 点对点,开发人员除了 WifiP2PManager.connect() 方法外别无选择。调用它会在正在连接的设备上触发一个对话框(按钮配置),并且该对话框只会在两个设备首次相互连接时出现。

顺便说一下...修改WifiP2pConfigWpsInfo 是没用的;它将始终使用按钮配置选项。我在我拥有的设备(Asus ZC520TL-Nougat、Asus ZE551ML-Marshmallow、Huawei Y5-Marshmallow 和 Huawei T1-KitKat)上对其进行了测试。即使 wifip2pconfig.wps.setup 不等于 WpsInfo.PBC,PBC 对话框也会出现。如果不是所有设备都如此,请随时纠正我,因为它可能只是 OEM 问题。

欲了解更多信息,请访问 Wi-Fi peer-to-peer overview .

关于android - Android 上的 Wifi 感知和 Wifi P2P 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52760132/

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