I have two iOS devices finding each other successfully using the Bonjour API, but since they are both simultaneously publishing and browsing, they also see themselves appearing in the list of available services. There must be some bit of information each endpoint can use to determine that a service is their own and exclude it from their list... I'm sure I just missed it somewhere - any ideas?
I have used the examples from the docs with a few small changes.
mDNS doesn't make any distinction between device boundaries- every mDNS resolver on the link-local network listens for all multicast packets sent to
224.0.0.251
by default regardless of origin. Think of it as a glorified short-wave radio. Well, kind of.That means when you browse for services, NSNetServiceBrowser doesn't discriminate between hosts (and there are times when I've found that to be a useful feature in server-side applications).
I'd suggest the easiest way to ignore your own services is to check that the
hostname
of theNSNetService
object returned in thenetServiceBrowser:didFindService:moreComing:
callback isn't yours before doing whatever you need to do with it.