Search code examples
iphonemacoswifidata-transferadhoc

Ad Hoc Wifi Connection Between iPhone & Mac - Possible?


I was just wondering if it is possible to set up a data transfer tunnel between an iPhone and a Mac using the Wifi hardware present on both devices? My main objective is to transfer data from my iPhone to my Mac through an app along an ad hoc wifi connection. If there are any other methods you would like to suggest, then please do.

Looking forward to your replies.

Thanks!

A.K.


Solution

  • You can make use of Bonjour, via NSNetServices and CFNetServices APIs.

    Basically:

    1. Create a server on the Mac
    2. Announce the server via Bonjour
    3. Browse Bonjour on the phone and resolve the bonjour service.
    4. Establish connection
    5. Exchange data via socket streams