i am working on an App that uses wifi network to pass data from one ipad to another ipads . i have already referred the following sample code about:

http://mobileorchard.com/tutorial-networking-and-bonjour-on-ip

The above sample code connects Devices using wifi and can exchange messages using Cfnetworking and Bonjour. My problem is that i am not able to see Active Servers all the time .While Some times it Shows me Active servers and i can easily connect with and Exchange Messages but when i relaunch or open the app after some time it doesn't show me active servers so i am unable to connect and exchange messages. The same problem occurs in the sample code available from above link having tutorial on to Send data over wifi to another Devices. I am Stucked up over here where i am unable to connect with active Devices all the time because not able to access those servers.

In chatty sample code same problem occurs where you can see active chat room's and connect with but some times you will not be able to see those active chat rooms availabe even if there are active servers who have already started new chat room where all Devices are connected to same wifi network.

Any help would be highly Appreciable , Thanks in advance.

1

There are 1 answers

0
dgatwood On

Any chance the wi-fi interface on the device is going to sleep from disuse? Or that the user roamed to a different Wi-Fi access point with the same name that isn't bridged via Bonjour?

Have you considered using Multipeer Connectivity instead of using Bonjour directly? IIRC, that API would let you communicate even if the devices are not on the same Wi-Fi network, which is probably what you want anyway.