Network Framework peer to peer limitations

Hi all,

We've been exploring the capabilities of the Network.framework for peer-to-peer communication and have run into some behavior that we haven't been able to fully explain with the existing documentation.

In our tests, we’re working with 12 iOS devices, all disconnected from Wi-Fi to force communication over Apple Wireless Direct Link (AWDL). While using the Network.framework to create peer-to-peer connections, we observed that the number of connected peers never exceeded 8, despite all 12 devices being active and configured identically.

Some questions we’re hoping to get clarification or discussion on:

Is there a known upper limit to the number of peer-to-peer connections supported via AWDL?

Are there conditions under which the framework or system limits or throttles visible peers?

Does AWDL behavior vary by hardware model, iOS version, or backgrounding state of the app?

Is there any official documentation or guidance around peer discovery or connection limits when using NWBrowser and NWConnection in a peer-to-peer context?

We’d appreciate any insights from the Apple engineering team or other developers who have worked with larger peer groups using Network.framework in peer-to-peer mode.

Answered by DTS Engineer in 840521022
Written by BradenMess in 785308021
Is there any official documentation or guidance around peer discovery or connection limits … ?

No.

Unofficially, peer-to-peer Wi-Fi is not intended to scale to this limit. I’m surprised you’re hitting a hard limit of 8 [1], but I’m not surprised that things fall apart around that point. The on-the-wire protocol used by peer-to-peer Wi-Fi [2] gets exponentially worse as you increase the number of peers.

In short, if you have a large number of peers you need infrastructure Wi-Fi. It’s really that simple.

Share and Enjoy

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

[1] Although perhaps I shouldn’t be, given that kMCSessionMaximumNumberOfPeers is 8. Having said that, I looked at how kMCSessionMaximumNumberOfPeers is generated and, yeah, it’s just a hard-coded value, so there’s no hard connection between it and the limit you’re seeing.

IMPORTANT It’s a common misconception that Multipeer Connectivity is the only way to interact with peer-to-peer Wi-Fi. Multipeer Connectivity and other APIs, like Network framework and NSNetService, all use the same underlying infrastructure. You’ve obviously not fallen into this trap, but I just wanna call this out to make sure that folks following along at home don’t get the wrong impression here.

[2] Which, as we mention in TN3111 iOS Wi-Fi API overview, is not documented for third-party use.

Hey BradenMess, not sure I have an answer to any of this but following along. I share the same issue for my use case as well. Can anyone help??

Hello BradenMess! I faced similar issues on my end. I hope we can get some clarification on this from other devs or an apple engineer.

WOW! What an insightful post. I hope you find a solution soon.

Accepted Answer
Written by BradenMess in 785308021
Is there any official documentation or guidance around peer discovery or connection limits … ?

No.

Unofficially, peer-to-peer Wi-Fi is not intended to scale to this limit. I’m surprised you’re hitting a hard limit of 8 [1], but I’m not surprised that things fall apart around that point. The on-the-wire protocol used by peer-to-peer Wi-Fi [2] gets exponentially worse as you increase the number of peers.

In short, if you have a large number of peers you need infrastructure Wi-Fi. It’s really that simple.

Share and Enjoy

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

[1] Although perhaps I shouldn’t be, given that kMCSessionMaximumNumberOfPeers is 8. Having said that, I looked at how kMCSessionMaximumNumberOfPeers is generated and, yeah, it’s just a hard-coded value, so there’s no hard connection between it and the limit you’re seeing.

IMPORTANT It’s a common misconception that Multipeer Connectivity is the only way to interact with peer-to-peer Wi-Fi. Multipeer Connectivity and other APIs, like Network framework and NSNetService, all use the same underlying infrastructure. You’ve obviously not fallen into this trap, but I just wanna call this out to make sure that folks following along at home don’t get the wrong impression here.

[2] Which, as we mention in TN3111 iOS Wi-Fi API overview, is not documented for third-party use.

Network Framework peer to peer limitations
 
 
Q