Creating ad hoc wifi hotspot on iPhone?

Discussion in 'iOS Programming' started by craig1410, Jul 21, 2010.

  1. craig1410 macrumors 65816


    Mar 22, 2007

    Many of us will have heard of the MyWi iPhone tethering app which is widely used on jailbroken phones. It seems to work well to allow sharing of the iPhone's 3G connection via WiFi with some limitations such as poor battery life etc.

    As an iPad WiFi owner, I am keen to be able to occasionally use my iPhone to provide short term, ad hoc connectivity for my iPad but I don't want to jailbreak my phone to install MyWi. Partly this is because I am using my iPhone for development purposes and partly because I like it fine the way it is.

    So, since I am a developer and have paid my $99 developer's licence, I am interested in creating my own (very basic) version of MyWi if possible. I have already come across iProxy source code which provides the proxy functionality but I can't find any guidance or sample source code about what is involved in creating a WiFi hotspot. I expect I will need to do stuff like initialise the chipset and then wait for an incoming connection and then do some authentication followed by issuing a DHCP address but I'm sure this is over simplified...

    Does anyone know of any sample source code in this area or do you know of any documentation (eg. RFC docs) which describe the protocols surrounding creation of a hotspot/router?

    Please note, I have no intention of trying to produce a commercial app but just want to use this for my own purposes and education. If my phone was jailbroken then I'd have no issue with spending $20 on MyWi but I don't want to jailbreak.

  2. ulbador macrumors 68000


    Feb 11, 2010
    I'm sure it's possible, but unfortunately the available documentation for the MobileWifi.Framework (the private API that would make this possible) is a bit slim. About all you can do now is detect available networks (which is how many of the WiFi hotspot finders that were pulled worked).

    I can't tell you exactly how MyWi works, but I have a feeling it uses something like iwconfig, which is a Linux program to handle the WiFi connection. Setting up a hotspot with iwconfig is pretty trivial. Unfortunately, without reinventing a ton of wheels, this would again require a jailbroken iPhone.
  3. craig1410 thread starter macrumors 65816


    Mar 22, 2007
    Thanks for taking time to reply, I was beginning to think I was going to draw a blank on this question... :)

    Yeah, I was hoping that maybe there was an API which I could use but perhaps not. I have used iwconfig on Linux before so i know what you are talking about. I never considered the possibility that MyWi might use the likes of iwconfig so thanks for opening my mind to that possibility.

    Maybe I will look at iwconfig source code to see what it is doing.

    Thanks again,
  4. AndyCodez macrumors regular

    Aug 6, 2009
    Be nice if we could find an open source one so we could just install it with our dev accounts haha.
  5. Stongfort macrumors newbie

    Nov 2, 2010
    Does anyone know if there's more progress on something like this? I would love to be able to tether my iPad wifi to my iPhone.

    Right now the only thing without jailbreaking is the iProxy software you can install on a dev account. It works, sort of, but requires a 3rd device to set up an ad-hoc network. That really kills the portability of the concept.
  6. Mr. Zorg macrumors regular

    Mr. Zorg

    Sep 5, 2007
    I'm interested in this too. I'd even be willing to pay for it, I just don't want to jailbreak when I can already load my own apps. :)
  7. PBG4 Dude macrumors 68020

    PBG4 Dude

    Jul 6, 2007
    Hah, I'm in the same boat too. Managed to get iProxy up and running this afternoon but I think a WiFi hotspot would be much cleaner.

    Anyone know if the hotspot functionality in Android would be easy to ferret out for porting purposes?
  8. kev21986 macrumors newbie

    Apr 7, 2008
  9. cnstoll macrumors 6502

    Aug 29, 2010
    For what it's worth, remember that without jailbreaking apps are all still subject to certain limitations and bounds, such as the sandbox. I'm not very familiar with the requirements of creating a wifi hotspot, but one thing I found while trying to compile and run the Terminal mobile app from a google code project using my developer account was that even though I can install it on my won't work because those restrictions are still in place since my phone isn't jailbroken.

    Just some food for thought.
  10. wheli macrumors newbie

    Jun 12, 2008
    any progress on this? I contacted MyWi to see they would sell me a distribution that I can install it as a developer and am waiting to hear back....

Share This Page