其他分享
首页 > 其他分享> > Android上的Wifi感知与Wifi P2P之间有何区别?

Android上的Wifi感知与Wifi P2P之间有何区别?

作者:互联网

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

使用WiFi P2P,您可以在不需要公共网络的情况下在两个或多个附近的设备之间建立连接.但是android docs spec还指出

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()方法外别无选择.调用它会在所连接的设备上触发一个对话框(按钮配置),并且仅当两个设备首次相互连接时才会出现该对话框.顺便说一句…修改WifiP2pConfig的WpsInfo是没有用的.它将始终使用“按钮配置”选项.

有关更多信息,请访问Wi-Fi peer-to-peer overview.

标签:wifi-direct,wifi,android-wifi,wifip2p,android
来源: https://codeday.me/bug/20191108/2008377.html