iPad 网络服务支持更多设备
嘿,
我想制作一个网络服务,让更多的 ipad 可以同时连接。
我让一台 1 iPad 打开 NSNet 服务并打开输入和输出流。
我在 iPad A 上启动了一个网络服务,
当用 iPad B 连接到 iPad A 时,效果很好。 但当 iPad C 尝试连接时,会发生以下情况: - 尝试解决 NSNetService。 - 解决成功 - 打开输入流 - 打开输出流(eventCode 等于 NSStreamEventOpenCompleted) - 遇到结束
因为遇到结束我无法连接,这对我来说很清楚,但是我该如何让它工作?
是否可以在同一个网络流上连接更多设备?或者我必须采取另一种解决方案?
谢谢
Heey
I want to make a netservice where more ipads can connect to at the same time.
I made a one 1 iPad open a NSNetservice and open the in- and outputstream.
I started a netservice on iPad A,
When connecting with iPad B to iPad A this just works fine.
But when iPad C tries to connect the following happens:
- Tries to resolve the NSNetService.
- Resolves succesfull
- Open input stream
- Open output stream (eventCode equals NSStreamEventOpenCompleted)
- End encountered
Because of the end encounters i cant connect, thats clear for me, but how do i make it work?
Is it possible to connect with more devices on the same netstream? Or do i have to make another solution?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你必须为每个连接创建一个新线程。至少,当我为 iPhone 构建消息应用程序时,这对我有用。每个连接都将持有线程,并等待响应(线程将“冻结”)。
I think you have to create a new thread for each connection. At least, this worked for me when I built a message app for the iPhone. Each connection will hold the thread, and wait for a response (the thread will 'freeze').