iOS Bonjour Over the Internet
I know that iOS's Bonjour implementation (NSNetService, NSNetServiceBrowser) work out of the box on local networks.
The documentation says it is possible to set up a Bonjour DNS server to allow connecting users over the internet, so my questions are:
- What is the Bonjour DNS server interface? is there a sample I can start from?
- Does 开发者_如何转开发the DNS Server responsible for the initial hand-shaking\connection of the peers and the rest (send\rec data) will be directly between the peers?
- Does the DNS Server provide a NAT hole-punching mechanism?
Thanks!
Bonjour local service discoveryis based on "multicast DNS". whenever some client wants to find out anything about the network or services on the network it uses the multicast address 224.0.0.251
, meaning only clients within that multicast group can use bonjour together.
the 244.0.0/24 IP-Address space is defined as "Local Network Control Block" by RFC5771 and will not be forwarded out of your local network.
BUT really, Bonjour is just a DNS-based method - you can tell NSServiceBrowser to search in a non-local domain, which just requires the DNS server to respond to specific requests (as described in Manually Adding DNS-SD Service Discovery Records to an Existing Name Server)
This allows service discovery over the internet and even service registration if you get DNS Update working (Setting up a Bonjour Name Server), but nothing more - you have to care about hole-punching yourself.
So get yourself a BIND-server and start trying ;)
精彩评论