Network Framework: LAN vs Wifi vs Peer to Peer Wifi Switching

I would like to understand the behaviour of Network framework when I have established a connection between 2 iOS devices which are connected through LAN and the same Wifi. Assumptions:

  • Enabled includePeerToPeer.
  • Devices are discovered and connected through Bonjour:
  1. When the connection establishes for the first time, does it automatically decide which interface to pick? I see some posts which point to Happy Eyeball algorithm but that seem to point more towards ipv4 vs ipv6 rather than Wifi vs LAN vs P2P.
  2. In the middle of a connection, if the established connection has issues, does the Network framework automatically switch to the best available interface?
  3. If not, I would assume the app will have to handle the switching in betterPathUpdateHandler callback? I’m curious what needs to be done here. Do I just create a new connection and hope that it picks the actual better path?
  4. The NWInterface.InterfaceType doesnt have a type for peer to peer wifi. Does that mean that when the interface actually switches to peer to peer, the InterfaceType will be other?

It would be great if there is a workflow or example of how this needs to be handled with multiple available Interfaces.

Network Framework: LAN vs Wifi vs Peer to Peer Wifi Switching
 
 
Q