Search code examples
iosnetworkingwifiipv6network-framework

iPhone connectivity over wifi , socket & Apple NW framework


I have local storage in iPhone which needs to be synchronized with another iPhone. These iPhones are connected to the same WiFi, but the WiFi does not have an internet connection. There would be events happening in these iPhones which has to be synchronized realtime across the local storage of all iPhones which are part of the same WiFi network

We tried multiple options and all seems to work fine

  1. Run GCDWebserver in one phone which will act as a server.
  2. Use CocoAsyncSocket and connect iPhones via CFSocket
  3. Use Apple Network Framework

The challenge that we are facing in all these options is that when the device moves across different access points (WiFi SSID is the same), the connection to the host is lost.

Why do the devices lose connection when the iPhone moves to another WiFi Access point, but still on the same SSID?

We do not have the option to change any setting on the router/WiFi. Is it possible to programmatically address this issue?


Solution

  • We are able to make this work by using Apple Network Framework and requesting for ipV6 address while establishing connection.

    What we assume is that each device gets a unique address in ipV6 supported routers and hence there is no restriction in connecting devices across access points.

    Appreciate if anybody can clarify the reason why it works with ipV6.