简体   繁体   English

是否有更可靠的 GKSession 替代方案允许在 3 个以上设备之间进行 P2P?

[英]Are there more reliable alternatives to GKSession which allow P2P between more than 3 devices?

Some people pointed out that Bonjour is more reliable.有人指出,卓悦更可靠。 Bonjour only is WiFi and does not support Bluetooth, no? Bonjour 只有 WiFi,不支持蓝牙,不是吗?

There must be an alternative to GKSession which just combines all the good things of Bonjour and Bluetooth in one simple to use API but I can't find it.必须有GKSession的替代方案,它将 Bonjour 和蓝牙的所有优点结合在一个简单易用的 API 中,但我找不到它。

I need to automatically connect up to 8 devices for a game where players can join anytime, and GKSession seems to have a total limit of 3 for PeerToPeer.对于一个玩家可以随时加入的游戏,我需要自动连接最多 8 台设备,而GKSession似乎对 PeerToPeer 的总限制为 3。

GKSession will allow for up to 16 devices as of iOS 6, I believe.我相信,从 iOS 6 开始,GKSession 最多可以支持 16 台设备。 It should certainly work with at least 8, being that Bluetooth supports 8 devices.它当然应该至少支持 8 个,因为蓝牙支持 8 个设备。

I have successfully connected 6 devices without issue.我已成功连接 6 台设备,没有出现问题。

Updating for iOS 7, since GKSession is now deprecated.更新 iOS 7,因为GKSession现在已弃用。

The Multipeer Connectivity framework's MCSession class can connect up to 8 peers (current value of kMCSessionMaximumNumberOfPeers ). Multipeer Connectivity 框架的MCSession类最多可以连接 8 个对等点( kMCSessionMaximumNumberOfPeers当前值)。

For anyone interested, I created MCSessionP2P , a demo app that illustrates the ad-hoc networking features of MCSession .对于任何感兴趣的人,我创建了MCSessionP2P ,这是一个演示应用程序,用于说明MCSession的临时网络功能。 The app advertises itself via Wi-Fi or Bluetooth and programmatically connects to available peers, establishing a peer-to-peer network.该应用程序通过 Wi-Fi 或蓝牙宣传自己,并以编程方式连接到可用的对等点,建立对等网络。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM