iOS 中通过 wifi 的点对点网络
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15364876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Peer-to-peer network over wifi in iOS
提问by Andrew
I've been at this for a few days now, and can't seem to find a solution. I want to create a peer to peer network over wifi on iOS. All open source code seems to be supporting running a server or being a client, but there's no code built to support being both - a peer. Is anybody aware of a way I can do this?
我已经在这几天了,似乎无法找到解决方案。我想在 iOS 上通过 wifi 创建一个对等网络。所有开源代码似乎都支持运行服务器或作为客户端,但没有构建代码来支持两者 - 对等。有人知道我可以这样做吗?
回答by darrinm
iOS 7 adds the Multipeer Connectivity Frameworkfor exactly this purpose.
iOS 7正是为此目的添加了多点连接框架。
回答by Mr Rogers
回答by naeemjawaid
回答by cleverbit
You cannot create a wi-fi network programmatically in iOS using current APIs. GameKit offers some APIs to do so over bluetooth however.
您无法使用当前 API 在 iOS 中以编程方式创建 wi-fi 网络。然而,GameKit 提供了一些 API 来通过蓝牙进行操作。
If you wish to implement a custom solution using CocoaHTTPServer, be aware that you will still not be able to create a direct wi-fi connection, you will simply be able to connect devices on the same (pre-existing) wi-fi network.
如果您希望使用 CocoaHTTPServer 实现自定义解决方案,请注意您仍然无法创建直接的 wi-fi 连接,您只能连接同一(预先存在的)wi-fi 网络上的设备。
Ad-hoc peer to peer Wi-Fi (such as 802.11s) in iOS is still a few years off. Maybe iOSX ;)
iOS 中的点对点 Wi-Fi(例如 802.11s)还需要几年时间。也许 iOSX ;)
回答by JuJoDi
iOS supports the Multipeer Connectivity frameworkwhich enables iOS devices to talk to each other over Bluetooth, infrastructure (with a router) WiFi, or P2P.
iOS 支持Multipeer Connectivity 框架,该框架使 iOS 设备能够通过蓝牙、基础设施(带有路由器)、WiFi 或 P2P 相互通信。
It does not, however, provide a way to explicitly use P2P. There is a layer of abstraction away from how any of a device's peers (other iOS devices) are connected, and it does not currently allow for non-iOS devices to be connected.
但是,它没有提供明确使用 P2P 的方法。设备的任何对等设备(其他 iOS 设备)的连接方式有一个抽象层,并且目前不允许连接非 iOS 设备。