Does iPhone support WiFi ad-hoc mode?
Solution 1
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.
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.
You can use Game Kit, CoreBluetooth (in limited circumstances), or you can use something like CocoaHTTPServer.
Solution 2
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.
Solution 3
As of iOS 7 you can use the Multipeer Connectivity Framework to 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.
Jing
Updated on February 13, 2020Comments
-
Jing about 4 years
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?
-
Jing over 12 yearsI'm working on Gamekit/Bluetooth with multi-user, crash very often. I'm trying to understand CocoaHttpServer project,sorry my networking knowledge is poor, does it means I don't need wifi hotpot around? What job does it do?
-
Andy over 12 yearsAd hoc wifi networking IS supported, but you can not CREATE one.
-
Dermot over 11 yearsI think he meant between iPhones, its the context of the question.
-
Andy over 11 yearsThis is incorrect, it is supported, but you must specify the connection parameters in the settings app.
-
Andy over 11 yearsYes, it is supported BETWEEN phones.
-
Andy over 11 yearsNo, it wasnt as it has been for several years, so you were incorrect at the time of posting. Retaliation downvotes IS REALLY BAD BEHAVIOR! You better stop this immediately and start posting correct answers, or accept that you may be wrong. We all are sometimes.
-
Mr47 over 11 years...iPhones connect to one another... Your answer implies yet another device creating a network.
-
Art Geigel almost 11 yearsThis might have been the right answer in November 2011 but it appears to not be the case anymore... Whenever I try to connect to an ad hoc network from within Settings on the iPhone I get "Unable to join the network" message.
-
Art Geigel almost 11 yearsWTF, just for fun I reset my iPhone and tried to connect to the ad hoc network again and I was able to... if you're seeing the connection problem I described above may want to try this.
-
David Doria almost 11 years@Moshe Any thoughts as to WHY this functionality is not enabled/allowed? It seems strange to me.
-
Moshe almost 11 yearsProbably limitations of earlier devices. Of course there are some surprises coming this fall. Watch session 708 from WWDC 2013.
-
SeB.Fr about 10 yearsFor jailbroken ios you can use Mywy or Pdanet to create hadoc wifi network