Did iDevices find each other on a private local network via bonjour?

MultipeerConnectivity use NSNetService to register a bonjour service with 'local.' domain, iPhone A and iPhone B can find each other without a local network. For example, iPhone A is connecting to wifi A and iPhone B is connecting to wifi B, but they also can find each other. Are they on a private local network or does bonjour support a p2p connection without a local network?

Replies

If you set

includesPeerToPeer
,
NSNetService
will browse on peer-to-peer interfaces. The relevant peer-to-peer interface these days is peer-to-peer Wi-Fi. This allows nearby Apple devices to discovery each other and communicate even if they’re not on the same infrastructure Wi-Fi.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for your reply.


I use the `dns_sd.h` api to search for other devices(Apple device and non Apple device) which pulish itself, and they can find each other on the same infrastructure Wi-Fi, but it does not work when the device leaves Wi-Fi. I found a flag named `kDNSServiceFlagsIncludeP2P` and an interface index named `kDNSServiceInterfaceIndexP2P` in `dns_sd.h`, can I use it to establish a p2p connection between Apple device and non Apple device without the same infrastructure Wi-Fi?

can I use it to establish a p2p connection between Apple device and non Apple device without the same infrastructure Wi-Fi?

No. The peer-to-peer Wi-Fi protocol used by Bonjour is not documented for third-party use, and thus this only works between Apple devices.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"