iPhone 中的 Bonjour 功能

发布于 2024-10-07 21:46:05 字数 546 浏览 0 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文