Sending data in Android WiFi Direct service discovery instead of connecting

后端 未结 1 991
青春惊慌失措
青春惊慌失措 2021-01-13 15:18

Following the documentation here:

http://developer.android.com/training/connect-devices-wirelessly/nsd-wifi-direct.html

It appears to be possible to broadcas

1条回答
  •  隐瞒了意图╮
    2021-01-13 16:06

    • The key/value pairs you pass into WifiP2pDnsSdServiceInfo object are going to be encapsulated into DNS multicast messages, as specified in DNS-Based Service Discovery.

    • Multicast traffic on WiFi is especially expensive, so it is not recommended to use this for messaging. Only for critical things like service discovery.

    • Depending on implementation (android), the under framework may pool all service discovery records/responses, before it calls your callbacks. This can add significant (even unpredictable) delay for your simple P2P messaging.

    • This is basically a DNS messaging, so your "messages" may be cached locally. DNS queries could also try mid-level optimizations like pooling, retries, query filtering, prioritization etc.

    • There is no reliability guarantee so your messages may be lost.

    • Multicast traffic, which is used here, can result in significant battery drain on android, see here

    0 讨论(0)
提交回复
热议问题