Hi I want to find all people using my app within a same network, say if its a wifi network then i want to get all people using my app in that particular network.
their profile data existing in my database (mySQL) with their location. I can get the users As per location But my Question is to find them as per network. Any ideas how to start to do that?
Im not saying using Bonjour (Zeroconf) is the best way to achieve what you want – but you can certainly achieve your goal using it.
Bonjour is used in two ways:
– publishing a service
– detecting (browsing for) available services
For your task you’d have to do both.
One basic description can be found here: Bonjour Overview and its application in iOS
If you decide to use Bonjour then you’ll find a lot of documentation on Bonjour for Developers
Basically, you need to publish a service: Bonjour Programming > Section 18.2. Publishing a Service
The publishing class (usually
appDelegate) should be also aNSNetServicedelegate.You should also handle delegate methods (and some
appDelegatemethods):And browse for existing services: Bonjour! (cocoanetics)
(you’ll only need the bottom part of the page)
PS: Bonjour might be tricky to start with but it is certainly a useful knowledge.
Depends on what user experience exactly you want. A good alternative to Bonjour would most certainly
be
GameKit(GKPeerPickerController) where user can actuallyselect to which devices (peers he wants to connect to).
This should work in Wi-Fi or via BlueTooth.