iOS and Wi-Fi Direct

My question is fairly straight forward - can iOS create a Wi-Fi Direct group that can be joined by non-iOS devices?


The only information I can find relating to iOS direct peer connectivity is https://developer.apple.com/library/prerelease/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/index.html


More specifically, "The Multipeer Connectivity framework provides support for discovering services provided by nearby iOS devices..."


Based on this I would say no, but technically speaking, there should be no limitation for Wi-Fi Direct as it is an open standard, and apps like AirDrop already use it.

My question is fairly straight forward - can iOS create a Wi-Fi Direct group that can be joined by non-iOS devices?

No. The peer-to-peer Wi-Fi implemented by iOS (and recent versions of OS X) is not compatible with Wi-Fi Direct.

Note Just as an aside, you can access peer-to-peer Wi-Fi without using Multipeer Connectivity. The underlying technology is Bonjour + TCP/IP, and you can access that directly from your app. The WiTap sample code shows how.

Based on this I would say no, but technically speaking, there should be no limitation for Wi-Fi Direct as [...] apps like AirDrop already use it.

AirDrop does not use Wi-Fi Direct, but rather the Bonjour + TCP based peer-to-peer Wi-Fi discussed above.

Share and Enjoy

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

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

"AirDrop does not use Wi-Fi Direct, but rather the Bonjour + TCP based peer-to-peer Wi-Fi discussed above."


How does it do this when the two devices need not be on the same network? This is the problem we're trying to solve: there's no infrastructure Wi-Fi network. Our peripheral can host a network, but we'd like to avoid making the user leave our app to go to Settings to connect to our peripheral.


It seems the WiTap sample code requires all instances to be on the same network already, is that correct?

How does it do this when the two devices need not be on the same network?

Via an Apple-specific (not Wi-Fi Direct) peer-to-peer Wi-Fi protocol.

It seems the WiTap sample code requires all instances to be on the same network already, is that correct?

No. Although don’t take my word for it, try it yourself:

  1. grab two iOS devices

    Note the only requirement is that they each must be new enough to have a Lightning connector. Peer-to-peer Wi-Fi support is not tied to the Lightning connector, it's just a helpful coincidence that the hardware that supports peer-to-peer Wi-Fi also happens to have a Lightning connector and thus it's an easy way to identify that support.

  2. on each, forget the infrastructure Wi-Fi network

  3. on each, disable Bluetooth (which implements a different form of Apple-specific, Bonjour + TCP/IP peer-to-peer networking)

  4. on each, run WiTap and start a ‘game’

This is the problem we're trying to solve: there's no infrastructure Wi-Fi network. Our peripheral can host a network, but we'd like to avoid making the user leave our app to go to Settings to connect to our peripheral.

Ah, this is the first mention of non-Apple hardware in this thread. The situation with non-Apple hardware is more challenging because the peer-to-peer networking protocols (both Wi-Fi and Bluetooth) are not documented for third-party use.

Your options:

In a typical home accessory setup you want the accessory to join the same infrastructure Wi-Fi as all the other devices in the home. Apple explicitly supports this via the Wireless Accessory Configuration (WAC) mechanism. This lets an iOS device pass its Wi-Fi configuration to the accessory so that the accessory can join the same Wi-Fi network as the iOS device is currently on.

You can learn more about this in WWDC 2014 Session 701 "Designing Accessories for iOS and OS X".

https://developer.apple.com/videos/

WAC is part of MFi.

  • HomeKit accessories, also created under the aegis of MFi, have their own set of capabilities. Let me know if you’re interested in that angle.

  • Most other ad hoc and peer-to-peer Wi-Fi scenarios do not have good solutions. You can generally make things work, but it tends to be a manual process.

Share and Enjoy

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

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

Is there (or will there be) support for "ad-hoc" Airplay (audio) today? (i.e like the AppleTV guest mode)

Hi Eskimo,


I tried to use wi-fi direct with Wi-Tap as you outlined in your previous message but have discovered a problem with it. After about 1 minute of no tapping on either device, taps are no longer being received. If you keep tapping every second or so there is no problem and the data continues to be sent and received, however once you stop this repeated tapping the problem occurs after about 5 seconds.


We see the exact same issue with our own peer to peer product after we updated it to use wi-fi direct. After about 45 seconds of no activity (ie no transmission of any data from either device), data is no longer being received. If we send a "keep-alive" packet every second it works continously. If we change the keep-alive delay to 5 seconds it fails. There are no errors returned from the NSStream write method or via the NSStream handleEvent: callback in either Wi-Tap or our app.


Am I missing something? I am about to file a bug report.


Thanks

HI,


This thread is very interesting!


In my case, I'm developping a device that I would like to connect to very easily without any infrastructure. At the beggining I though of Bluetooth but the speed of the connection isn't high enough. So I though of Wifi Direct (P2P). With Android it's possible but I would like to control my device also with iOS !


What I understand from the answer of Eskimo is that it's not possible ?

"The situation with non-Apple hardware is more challenging because the peer-to-peer networking protocols (both Wi-Fi and Bluetooth) are not documented for third-party use."


Is there any solution ?


Thanks a lot for your documented answers !


Marc

What I understand from the answer of Eskimo is that it's not possible ?

Things haven’t changed since I posted that.

If your accessory is built under the aegis of MFi, you can get pretty reasonable speeds out of classic Bluetooth. If not, Bluetooth LE is the only option, and you’re correct in saying that it’s quite slow.

Share and Enjoy

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

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

DTS will close for the winter holidays at the end of business on Wed, 23 Dec 2015 and re-open on Mon, 4 Jan 2016.

Thank you for your prompt answer!

The other problem with Bluetooth is the range which is very short... Wifi Direct could solve this !

Marc

Thanks for the information.


My problem with Multipeer is WiFi file transfer is slow .

I get only 16 mega bits per second on iPhone 6S and 7mbps on iPhone 5.

(AC and N Wifi theoretical limits are 1300 and 450 mbps)


Would the Bonjour + TCP method be faster than Multipeer?

My problem with Multipeer is WiFi file transfer is slow .

There’s two potential issues here:

  • Peer-to-peer Wi-Fi has to jump through lots of hoops to work at all, and that slows things down.

  • Multipeer Connectivity was tuned for latency, not bandwidth.

Would the Bonjour + TCP method be faster than Multipeer?

My guess is that it won’t help a lot, but I recommend that you avoid guessing and simply test it yourself. Creating a simple Bonjour + TCP performance test is a relatively small task, and it’ll definitively answer this question.

Share and Enjoy

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

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

we are in the same boat: non apple hardware box under linux wants to talk to iOS over a peer to peer wifi link similar to how WiTap is doing it, without using inftrastructure wifi or converting either the box or the iOS device into a hotspot. bluetooth is not available in our box. is it possible these days (early 2017)?

Mike

is it possible these days (early 2017)?

Nothing has changed in the peer-to-peer networking space, other than the fact that I’ve documented the current state of affairs in QA1942 iOS Wi-Fi Management APIs.

Share and Enjoy

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

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

Thanks for the explanation. Can you point me to a document that gives the API on how to stream video from a MFI certified non-Apple device to an iOS device? None of the BT profiles listed in section 2.2 of https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdfseem to support video streaming or anything close to the 24Mbps classic BT max data rate (is there a special profile to get higher data rate)?https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf


Also, the accessory service types listed in the HomeKit spec don't mention a video camera accessory (https://developer.apple.com/reference/homekit/hmservice/accessory_service_types?language=objc)

Can you point me to a document that gives the API on how to stream video from a MFI certified non-Apple device to an iOS device?

The general API for talking to MFi devices is the ExternalAccessory framework. It’s possible that MFi might have easier integration points for video accessories but I can’t speak to that; other folks here in DTS support MFi accessory development.

If you want a definitive answer here, you should open an MFi tech support incident.

Share and Enjoy

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

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

Thanks, also can you comment on the HomeKit accessory type not mentioning a video camera accessory type. Per WWDC 2016 talk it appears that getting a video stream from HomeKit accessory is supported. Any sample code or pointer to details on how it is done will be useful. Will also file the ticket on MFI.

Hi Quinn, one more question. Suppose the accessory and iOS device are connected to the same WiFi AP. Suppose iOS device has local IP address IP1 and is listening on port P1. If the accessory opens a TCP connection to IP1/P1 (with the iOS app running) and WiFi AP allows packet to get routed, is there something in the iOS system that will prevent this TCP connection from being established?

… can you comment on the HomeKit accessory type not mentioning a video camera accessory type.

No, sorry. I’ve seen user-level reports of HomeKit video cameras but I’ve no idea how that works at the developer level. Again, this is something you should pursue via MFi’s support resources.

Suppose the accessory and iOS device are connected to the same WiFi AP. Suppose iOS device has local IP address IP1 and is listening on port P1. If the accessory opens a TCP connection to IP1/P1 (with the iOS app running) and WiFi AP allows packet to get routed, is there something in the iOS system that will prevent this TCP connection from being established?

That should work just fine. If I’m reading the above correctly your question is equivalent to “Can iOS run a server that listens for incoming TCP connections?”, and the answer to that is, “Yes”. There are tonnes of apps in the store that do this.

Share and Enjoy

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

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

Hi eskimo...


Very helpful FAQ, but isn't there a missing option under peer-to-peer? As I understand it, a third party device that is broadcasting a Bonjour WiFi service will be discoverable by an iOS app via the "NSNetServiceBrowser" class.


Thanks!

As I understand it, a third party device that is broadcasting a Bonjour WiFi service will be discoverable by an iOS app via the NSNetServiceBrowser class.

That’s only true if the devices can ‘see’ it other via the underlying network interface. So, it works just fine for Ethernet and infrastructure Wi-Fi, but won’t work for peer-to-peer Wi-Fi or Bluetooth because, as the Q&A says, the on-the-wire protocols used by this peer-to-peer networking are not documented for third-party use.

Share and Enjoy

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

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

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

I responded on the other thread where you asked the same question.

Share and Enjoy

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

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

Helpful FAQ.

Hi eskimo. Is there any change in the peer-to-peer networking space now(early 2019)?

The documentation of the multipeer connectivity framework changed. There is no limitation on connections to other iOS devices anymore. It just says „to other devices“. Did there change anything regarding support of WiFi direct? If yes, with which iOS version.

What I want to achieve is a SONOS like experience for connecting non-Apple devices to a WLAN. But these devices are not MFi certified. I.e, the iOS device connects via WiFi-Direct (or an adequate replacement) to the device and sends the connection information via https. The device will then close its WiFi Direct connection and access the other WiFi with the aforementioned information... Is this possible (ideally in a way that Android supports too)?

WAC is no option, correct?

Did there change anything regarding support of Wi-Fi Direct?

No. Apple’s peer-to-peer Wi-Fi continues to use an Apple protocol that’s not documented for third-party use.

WAC is clearly the best solution to this problem. If you can’t do WAC, your best place to start is NEHotspotConfigurationManager but the final user experience is likely to be quite bumpy. You can smooth things over using a side channel to get information from your accessory (like Bluetooth LE or a QR code) but it’s never going to be as smooth as WAC.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

I noticed that NetService and NetServiceBrowser have been deprecated as of iOS 15. Is there a new means to establish Wi-Fi Direct connections and share data with peers?

[While this is orthogonal to your actual issue, I want to reiterate a point from my first response on this thread: The peer-to-peer Wi-Fi networking supported by Apple platforms is not Wi-Fi Direct.]

As to the deprecation you mentioned, the <Foundation/NSNetServices.h> header says:

API_DEPRECATED("Use nw_connection_t or nw_listener_t in Network framework instead", macos(10.2, API_TO_BE_DEPRECATED), ios(2.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED)) API_UNAVAILABLE(watchos)
@interface NSNetService : NSObject {
…
}

…

API_DEPRECATED("Use nw_browser_t in Network framework instead", macos(10.2, API_TO_BE_DEPRECATED), ios(2.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED)) API_UNAVAILABLE(watchos)
@interface NSNetServiceBrowser : NSObject {
…
}

In short, these APIs were deprecated in favour of Network framework.

It’s annoying that these deprecation notes aren’t surfaced in the documentation. This came up recently in another content and I coulda sworn I filed a bug about that, but I can’t find it in my records so I’ve just file one right now (r. 85246804).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS and Wi-Fi Direct
 
 
Q