ios iPhone 是否支持 WiFi ad-hoc 模式?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7057053/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:05:34  来源:igfitidea点击:

Does iPhone support WiFi ad-hoc mode?

iphoneobjective-ciosadhoc

提问by Jing

Does the iPhone support ad-hoc network mode? Can iPhones connect to one another without requiring an existing network? If so, how can I create an Ad Hoc network in my app?

iPhone 是否支持 ad-hoc 网络模式?iPhone 能否在不需要现有网络的情况下相互连接?如果是这样,我如何在我的应用程序中创建一个 Ad Hoc 网络?

回答by Moshe

Updated Answer:

更新答案:

Have a look at the MultiPeer Connectivity Framework (documentation link)introduced in iOS 7. NSHipster has a nice write-up on it (link). Although you don't get direct network access, you can easily pass data between devices, and even use other devices to act as middlemen to other devices nearby.

看看iOS 7 中引入的MultiPeer Connectivity Framework(文档链接)。NSHipster 有一篇关于它的不错的文章(链接)。尽管您无法直接访问网络,但您可以轻松地在设备之间传递数据,甚至可以使用其他设备充当附近其他设备的中间人。

Legacy Answer:

遗留答案:

iOS devices cannot make peer-to-peer networks using the built in Settings app or available APIs. However, if you want to send data between devices in your app you have three options.

iOS 设备无法使用内置的“设置”应用程序或可用的 API 建立点对点网络。但是,如果您想在应用中的设备之间发送数据,您有三个选择。

You can use Game Kit, CoreBluetooth (in limited circumstances), or you can use something like CocoaHTTPServer.

您可以使用Game Kit、 CoreBluetooth (在有限的情况下),或者您可以使用CocoaHTTPServer 之类的东西

回答by Andy

Ad Hoc networking is supported on all iOS devices, but you can not create an ad hoc network from within your application. From the list of available networks, choose the ad hoc network you want to connect to, click the arrow and choose connect automatically. Now, your device will automatically connect to this network whenever it comes within range. After this you can use the connection using regular sockets or any other networking API.

所有 iOS 设备都支持 Ad Hoc 网络,但您无法从应用程序中创建 Ad Hoc 网络。从可用网络列表中,选择您要连接的 ad hoc 网络,单击箭头并选择自动连接。现在,只要您的设备在范围内,它就会自动连接到该网络。在此之后,您可以使用常规套接字或任何其他网络 API 来使用连接。

回答by mike harrington

As of iOS 7 you can use the Multipeer Connectivity Frameworkto connect two iPhones without an existing network. The framework will use Bluetooth, Wifi infrastructure mode, or Wifi Adhoc mode. Unfortunately, you don't have the ability to choose a transport, the framework decides on what is best.

从 iOS 7 开始,您可以使用Multipeer Connectivity Framework在没有现有网络的情况下连接两部 iPhone。该框架将使用蓝牙、Wifi 基础设施模式或 Wifi Adhoc 模式。不幸的是,您没有能力选择一种传输方式,框架会决定什么是最好的。

回答by hotpaw2

No, stock iPhones do not support ad-hoc Wifi communication.

不,库存 iPhone 不支持临时 Wifi 通信。

Yes, iPhones can connect to one another without an existing network, using Bluetooth (via the Gamekit API).

是的,iPhone 可以在没有现有网络的情况下使用蓝牙(通过 Gamekit API)相互连接。

回答by Jonathan

IOS 6.1.3 on an iPad mini will connect to an ad-hoc network

iPad mini 上的 IOS 6.1.3 将连接到 ad-hoc 网络

回答by TommyG

What you are describing is called Wifi peer-to-peer which iOS devices do not support at the moment.

您所描述的是 iOS 设备目前不支持的 Wifi 点对点。