State of Apple's "Wifi-Direct", UDP connections, etc.

Hi,


we've been exploring iOS/Mac networking stack recently, and we found out there were interesting stuff but also limitations.


It looks like Apple devices are not compatible with Wifi-Direct, where devices can talk to each other without being connected to the same network. But they do provide similar functionality through Bonjour (NSNetService Advertiser/Browser) networking, Multipeer Connectivity framework and Game Kit. All these only work with Apple devices, you can't establish such connection with Android device for instance.


Of these APIs, Bonjour is the one where we get more control on the connection, but has its own limitations. You can't establish the connection yourself, you must use the input/output streams provided by the framework. This, in particular, also means you can't make a UDP connection between 2 devices, as you have to use the TCP one established by the framework. That also rules out networking APIs (GCDAsyncSocket, etc.) that expect to start the connection themselves.


Another problem is that Wifi-Direct appears to be more and more common lately, Android, Raspberry PI, etc. This makes it hard to integrate iPhones in workflows that other platforms support and the various applications it enables.


Is this analysis correct & in accordance to the current networking situation on Apple devices? Can we expect that Wifi-Direct will be provided at some point? Or at least more control in the way we establish direct connections between devices (UDP)?


Thanks!

It looks like Apple devices are not compatible with [Wi-Fi Direct] …

Correct. The peer-to-peer Wi-Fi support on Apple platforms uses an Apple protocol that’s unrelated to Wi-Fi Direct and not documented for third-party use.

But they do provide similar functionality through Bonjour …

Similar, but different in one key aspect: Wi-Fi Direct is point-to-point whereas Apple’s peer-to-peer Wi-Fi supports N x M connectivity.

This, in particular, also means you can't make a UDP connection between 2 devices, as you have to use the TCP one established by the framework.

UDP is definitely a challenge. See this post.

That also rules out networking APIs (GCDAsyncSocket, etc.) that expect to start the connection themselves.

The peer-to-peer magic is only relevant during the connection establishment phase. If you want to run a TCP connection with some other API, you can extract the socket from the streams and use it how you will. Check out

k
and
kCFStreamPropertySocketNativeHandle
.

Share and Enjoy

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

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

Thank you Quinn for your answer.


By NxM, do you mean that a given advertiser (server) can have multiple clients simultaneously? Or is it something else?

For UDP, yes I've seen it, that's the post of my colleague sitting just on my left . We've tried, but could not get it to work, seems to be tricky.


Raphael

By N x M, do you mean that a given advertiser (server) can have multiple clients simultaneously?

Apple’s peer-to-peer Wi-Fi allows N clients to talk to M servers, much like infrastructure Wi-Fi does. For example, if two servers, A and B, register a service, and two clients, C and D, browse for services, C can see and communicate with both A and B, and likewise for D.

It’s pretty neat, when it works (-:

For UDP, yes I've seen it, that's the post of my colleague sitting just on my left. We've tried, but could not get it to work, seems to be tricky.

Bummer. As I said in the other thread, this is a perfect enhancement request candidate. If you do file it, please post your bug number, just for the record.

Share and Enjoy

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

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

Thank you for the explanation. We'll submit an enhancement request and let you know.


Raphael

Thanks for your support!


could you explore this iPad technology please

https://www.youtube.com/watch?v=WfFa9WxxI2Q


How they did it? what used? They never use any wifi router!


First of all on iPad(server) they create special access code and then "teacher" share this code with "students" iPads and students fill the code in their APPLICATION (not in the iPad settings) and after that students iPads !automatically! connects to the server iPad, without any wifi settings et c

could you explore this iPad technology please

I’m not sure which bit you’re confused by. Notably:

  • All the devices in that video are from Apple, and thus support Apple’s peer-to-peer Wi-Fi technology

  • As I mentioned back on 8 Nov, Apple’s peer-to-peer Wi-Fi allows N clients to talk to M servers

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
State of Apple's "Wifi-Direct", UDP connections, etc.
 
 
Q