Re: Bonjour server with multiple clients
Re: Bonjour server with multiple clients
- Subject: Re: Bonjour server with multiple clients
- From: Jim Correia <email@hidden>
- Date: Fri, 9 Jan 2009 16:49:43 -0500
On Jan 9, 2009, at 2:47 PM, Dave DeLong wrote:
I'm writing a simple voting app, where one instance of the app
creates a poll and then publishes it over Bonjour. Other instances
of the app on the same local network then find the publish poll, get
the list of voting options, and then allow users at each computer to
start submitting votes. The votes are sent back over the Bonjour
connection, fed into a thread-safe queue, and the poll owner
retrieves them at his leisure.
Bonjour is for advertising and discovering services.
"The votes are sent back over the Bonjour connection" doesn't make
sense. There is no such thing as a Bonjour connection. The client and
server communicate by whatever means they would have communicated
without zeroconf.
I've gotten this setup to work with one client. I have one instance
of my app publishing an NSNetService, and another using an
NSNetServiceBrowser to find it and connect to it. They can then
successfully pass information back and forth (it was very exciting
to get this working!).
I've tried having multiple clients connect, but the server doesn't
ever receive any of their messages. So I guess my question is this:
Does my server need to publish a new NSNetService for each connection?
No. If you have one service which allows multiple connections on the
advertised port, you only advertise your service once.
The specific details about how you accept multiple connections are
going to depend on how your server is implemented.
If not, how should I be going about this?
Any pointers would be greatly appreciated. The sample code I've
found seems to all be a single server-client pair.
The internet is full of servers which accept multiple connections.
Many of these servers are open source :-)
If you are looking for a simple example to get started with, the
Picture Sharing example shows a simple server implementation which
accepts multiple connections.
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden