2

Im developing an app where one iOS device act as "server", and other devices are acting like clients. Im getting hard time with understanding if I can make this using Bonjour

If I make an example: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ All devices have same app installed. All users are connected to the same WIFI.

User must login into app, and when it does, chat rooms are populated from CMS (web server) from internet.

All of them see e.g. all "chat rooms". But at the beginning chat rooms are all read only. Anyone can browse these, but nobody can write into them.

When administrator (user with admin privileges) opens one of the chat rooms; all clients are now able to write into "open" chat rooms.

Of course when one user writes something down, the other users see the newest comment from him.

Administrator should see all clients in chat room but clients cannot see each other.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

All samples which I have found (WiTap, videos from WWDC,...) are using two devices only. I've installed WiTap on 4 devices. And I can establish connection and working "sample" game with two devices.

Can Bonjour service be used in such way that multiple cients are connected to one "server"?

Any hints are very welcome!

Francis Bagan
  • 99
  • 2
  • 8
  • You say chat rooms are WEB-based. Then admin can lock/unlock chatrooms via web-server and all apps (including admins) work as clients. Or are you saying that admins app acts as a WEB server, too? – Rok Jarc Mar 16 '12 at 13:00
  • You have a point ... but writing in chat room is only available to clients which are connected to Bonjour service. Other clients (at home, or on other WIFI) will not be able to write to chat room. – Francis Bagan Mar 16 '12 at 13:25
  • 1
    Hmm, Bonjour is actually ment for announcing a service on a certain network. For example: if you have a hardware device (or application) that acts as a server (can be telnet, HTTP, custom TCP...) it can announce itself via Bojur. Clients will find it's IP:port via Bojur, that's all. From this point on "connection to" and "communication with" this server have nothing more to do with Bonjour. What i mean is: you don't connect to Bonjour service. You can announce your service via Bonjour so others can find you. And you can observe, which services are being announced on 'local' Bonjour. – Rok Jarc Mar 16 '12 at 13:33

2 Answers2

0

This is a good place to start. http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/ I have build the same Server and client with the help of chatty. But you will face one problem in iOS5 only, when the iphone will go to sleep mode, the socket connection lost. I am not able to solve this problem. So, looking for help. :)

Ayon Das
  • 21
  • 4
0

Yes, Bonjour can be used like that: for example Apache on Mac OS X has mod_bonjour so that web browsers can find a web server on the local network. That can mean having one server but multiple browsers: exactly the situation you describe.

One limitation is that the way Bonjour is configured in iOS means that the server and clients need to be on the same local network. It doesn't sound like the situation you describe is compatible with using Bonjour in that way, but then I also don't think you need to. You can use the DNS name of your chat server in the app, so any app can discover the server. The server can also be responsible for discovering which clients are connected and allowing people to find each other (indeed, I guess that's what the chat rooms are for).

  • Yes clients for this situation will be on the same network. And your answer sound interesting; I'll dig into your suggestions. – Francis Bagan Mar 20 '12 at 14:06