iPhone 中的 Bonjour 功能
我是 bonjour 网络的新手。我想找到所有使用 bonjour 功能的设备。现在我正在使用“Standford”提供的示例代码。通过使用它,我只能找到我的设备,我无法找到同一域下的其余设备。
对于发布,我正在使用:
self.netService = [[[NSNetService alloc] initWithDomain:@"" type:@"_sampleservice._tcp." name:[UIDevice currentDevice].name port:port] autorelease];
[self.netService publishWithOptions:NSNetServiceNoAutoRename];
对于浏览相同的网络:
[_browser searchForServicesOfType:@"_sampleservice._tcp" inDomain:@""];
通过使用它,我能够找到自己的设备名称,但我想检测所有周围的设备都具有相同的网络。
请帮我。太感谢了。
I'm new to bonjour networking. I want to find all the device using bonjour functionality. Right now I'm using sample code provided by "Standford". By using that I was able to find only my device, I was not able to find remaining device which are under the same domain.
For publishing I'm using:
self.netService = [[[NSNetService alloc] initWithDomain:@"" type:@"_sampleservice._tcp." name:[UIDevice currentDevice].name port:port] autorelease];
[self.netService publishWithOptions:NSNetServiceNoAutoRename];
For browsing same network:
[_browser searchForServicesOfType:@"_sampleservice._tcp" inDomain:@""];
By using this I was able to find my own device name, But I want to detect all the surrounding devices have same network.
Please help me. Thank you so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否已开始查看 Bonjour 概述?
http://developer.apple.com/library/ mac/#documentation/Cocoa/Conceptual/NetServices/Introduction.html
如果没有,请从这里开始。另请参阅 DNS 服务发现编程指南:
http: //developer.apple.com/library/mac/#documentation/Networking/Conceptual/dns_discovery_api/Introduction.html#//apple_ref/doc/uid/TP30000964
Have you started by looking at the Bonjour overview?
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NetServices/Introduction.html
If not, start there. Also have a look at the DNS Service Discovery programming guide:
http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/dns_discovery_api/Introduction.html#//apple_ref/doc/uid/TP30000964