Gamekit如何在iPhone中进行P2P

Gamekit如何在iPhone中进行P2P

本文介绍了Gamekit如何在iPhone中进行P2P WiFi连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须实现多人游戏,在该游戏中我同时使用蓝牙和WIFI进行p2p通信.特别是对于iPhone 1G,我必须通过WIFI进行连接.但在选择器中,默认连接类型为蓝牙.那么如何将其设置为WIFI.任何人都可以建议WIFI连接的示例代码.除了GKtank.提前致谢.

I have to implement multiplayer game in which I am doing p2p communication using both bluetooth and WIFI. Specially for iphone 1G I have to do connection via WIFI. but in picker default connection type is bluetooth. So how to set it to WIFI. Can anyone suggest sample codes for WIFI connection. except GKtank. Thanks in advance.

推荐答案

哈桑的答案是错误的.

Hassan’s answer is wrong.

GameKit的对等模型可以通过两种方式使用.蓝牙类(与PeerPicker等一起使用)基本上通过蓝牙实现Bonjour.但是,如果您想支持Wi-Fi和蓝牙,则最好的做法是建立一个基于Bonjour的框架"以建立连接,但是可以从标准Bonjour服务(用于Wi-Fi)或由以下服务建立的Bonjour服务中进行馈送:通过蓝牙的GameKit.

GameKit’s peer-to-peer model can be used in two ways. The Bluetooth classes (that work with PeerPicker, etc.) basically implement Bonjour over Bluetooth. However, if you want to support Wi-Fi and Bluetooth the best thing to do is have a Bonjour based "framework" for establishing the connections, but feed it either from the standard Bonjour services (for Wi-Fi) or from those established by GameKit over Bluetooth.

这篇文章提供了一些很好的指导,但是从本质上讲,您将需要使用Bonjour建立Wi-Fi对等连接.

This post provides some good pointers, but in essence, you will need to use Bonjour to establish your Wi-Fi peer-to-peer connection.

iPhone SDK 3.0中的GameKit

这篇关于Gamekit如何在iPhone中进行P2P WiFi连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:13