Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script to create an ad-hoc network to sync iPhone' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script to create an ad-hoc network to sync iPhone
Authored by: krader on Aug 22, '08 11:32:11AM

To answer the previous to repliers: The purpose of this is to allow iPhone applications such as OmniFocus and Things (both "Getting Things Done" applications) and SplashID to sync with their desktop counterpart. They don't sync using the iTunes wired sync mechanism. They do so using the Bonjour protocol to discover the desktop app. But that requires that the laptop and iPhone be on the same wireless network. Something you can't always arrange. For example, at my company the laptop is on a secure corporate wireless network while my iPhone can only join the public guest network. This means the apps on my iPhone can't see their desktop counterparts on my Macbook.

Being a long time UNIX user/programmer/administrator I tend to prefer shell scripts. So what I did was use the System Preferences Network panel to define an ad hoc network named "Ad Hoc" secured by a password and with 128 bit WEP encryption (to keep it simple use the same key for both).
I then wrote put two shell scripts in ~/bin named "work" and "adhoc". The adhoc script contains

#!/bin/ksh
sudo ifconfig en0 down
sudo scselect "Ad Hoc"
sudo ifconfig en1 up

Make it executable with "chmod 700 bin/adhoc" and now I can quickly switch to a private ad hoc network for syncing with my iPhone by just typing "adhoc" in a terminal window (I normally have one open anyway).
The "work" script contents should be obvious although in my case it also copies the dynamic hostname assigned to my Macbook to my Linux workstation using

hostname | ssh $workstation 'cat > .mac_hostname"

This allows me to easily connect back to my Macbook using VNC or SSH from my primary workstation.



[ Reply to This | # ]