Network Framework: Choosing Interface Types for Browsing/ Advertising

I am using Network framework for connecting two iPad devices that are connected through LAN and has Wifi enabled. I have enabled peerToPeerIncluded. I would like to understand how the framework chooses the interface types for browsing and discovering devices. When I start a browser with browser.run or listener.run, does the browser and advertiser browse and listen on all available interface types? My concern is that if it does in only one interface, Is there a chance that the browser is browsing in one interface(Lets say WiredEthernet) and the listener is listening on another interface(Lets say AWDL) and they dont discover?

Answered by DTS Engineer in 878471022
does the browser and advertiser browse and listen on all available interface types?

Yes.

At least by default. If you don’t want that behaviour, you can limit it to a specific interface type or a specific interface. The exact mechanism you use depends on which Network framework API you’re using. You mentioned the run(_:) method which suggests you’re using the shiny new one. In that case, the droids you’re looking for are listed here (search that page for interface).

Share and Enjoy

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

does the browser and advertiser browse and listen on all available interface types?

Yes.

At least by default. If you don’t want that behaviour, you can limit it to a specific interface type or a specific interface. The exact mechanism you use depends on which Network framework API you’re using. You mentioned the run(_:) method which suggests you’re using the shiny new one. In that case, the droids you’re looking for are listed here (search that page for interface).

Share and Enjoy

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

If you don’t want that behaviour, you can limit it to a specific interface type or a specific interface

For most cases I am ok to let the Network framework decide the interface type. But there are some cases where I want to allow only peer to peer. I've been using prohibitedInterfaceTypes to restrict wiredEthernet but I've not been able to restrict it to use only peer to peer. If I put .wifi in the prohibitedInterfaceTypes it doesnt connect through peer to peer either. Is there a way to force peer to peer only?

The original question was related to browsing alone. But I would want to do the interface type restriction for the connection as well.

Network Framework: Choosing Interface Types for Browsing/ Advertising
 
 
Q