• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bonjour server with multiple clients
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bonjour server with multiple clients


  • Subject: Re: Bonjour server with multiple clients
  • From: Dave DeLong <email@hidden>
  • Date: Mon, 12 Jan 2009 10:32:44 -0700

Let's see if I'm understanding things correctly...

The NSNetService publishes on a port and the server creates an NSFileHandle (fh1) for the NSNetService to begin listening to connection attempts. This fileHandle is listening on the same port on which the netService was published.

An NSNetServiceBrowser on the client finds the NSNetService and notifies via its netServiceBrowser:didFindService:moreComing: delegate method.

The client attempts to resolveWithTimeout to the netService.

If the resolving succeeds, then the client attempts to connect to the server by creating an NSFileHandle init'd with a fileDescriptor gleaned from the [netService addresses]; This now opens a port on the client.

(This is where things start getting fuzzy)
The server, meanwhile, is notified that someone is trying to hook up to fh1, and gets a new fileHandle via the notification object sent along in the NSFileHandleConnectionAcceptedNotification.


Is this new fileHandle different from the original fileHandle on the server? Is this new fileHandle operating on a different port than the original? Is this even the proper way to be going about this? Am I anywhere close to getting this working?

Thanks a ton!

Dave

On Jan 9, 2009, at 7:10 PM, Andrew Farmer wrote:

On 09 Jan 09, at 17:57, Markus Spoettl wrote:
How does one go about advertising a service via bonjour like in the Picture Sharing example AND allow multiple connections instead of just one? Is it as simple as creating multiple listeningSockets? Or create a new listening socket each time you get a connection to the existing one?

Reading a tutorial on network programming may prove helpful here. Here's one:


 http://beej.us/guide/bgnet/output/html/multipage/index.html

The short answer is that a single listening socket is sufficient; a new socket representing a connection is created when each client connects.
_______________________________________________

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


  • Follow-Ups:
    • Re: Bonjour server with multiple clients
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Bonjour server with multiple clients (From: Dave DeLong <email@hidden>)
 >Re: Bonjour server with multiple clients (From: Jim Correia <email@hidden>)
 >Re: Bonjour server with multiple clients (From: Markus Spoettl <email@hidden>)
 >Re: Bonjour server with multiple clients (From: "Kyle Sluder" <email@hidden>)
 >Re: Bonjour server with multiple clients (From: Markus Spoettl <email@hidden>)
 >Re: Bonjour server with multiple clients (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: Getting the network Machine Icon
  • Next by Date: Re: Using UIImageView for animations
  • Previous by thread: Re: Bonjour server with multiple clients
  • Next by thread: Re: Bonjour server with multiple clients
  • Index(es):
    • Date
    • Thread