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

A command line tool to handle PPP connections UNIX
I needed a way to stop and restart my PPP connection (pppoa/dsl). Killing pppd worked to stop the connection, but even with the exact same arguments obtained via ps laxww, the reconnection didn't work.

There is no command tool (to my knowledge) that does such a simple thing as to establish the default connection (as defined in the System Preferences). I tried an AppleScript (which I could call from command line) to send the Internet Connection application the connect message. But I felt that this was inelegant. And the trick would work only when logged in.

So I wrote a small tool using the SCNetworkConnection API, which can query the status of the default connection, start it, stop it and force-stop it (even if it is used by other apps). This is guaranteed to stay in sync with the GUI, and correctly notify running processes, because it uses Apple's own "high level" system calls.

The tool, along with the Xcode project and source, is freely available for download [PPPConnect.tgz -- 12KB]. I hope this can be of use to some of you.
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[7,502 views]  

A command line tool to handle PPP connections | 4 comments | Create New Account
Click here to return to the 'A command line tool to handle PPP connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A command line tool to handle PPP connections
Authored by: geohar on Nov 03, '04 03:57:02PM

Nice one! Could be useful for managing VPN remotely. You might want to tar up the product of a full build with zerolink turned off because the binary will be machine specific. Recompiled version myself. Thanks for sharing!



[ Reply to This | # ]
A command line tool to handle PPP connections
Authored by: bolet on Nov 03, '04 09:14:31PM

Thanks for pointing that out. I have little experience with Xcode yet. The new archive is made from the "deployment" target. And the executable size grew from 9 to about 23 Kb. I guess this should fix the machine specific issue.



[ Reply to This | # ]
A command line tool to handle PPP connections
Authored by: geohar on Nov 04, '04 07:06:22AM

Yup. Works a treat.



[ Reply to This | # ]
A command line tool to handle PPP connections
Authored by: jrcarroll on Nov 03, '04 08:58:00PM

Perhaps this is what the comment above is addressing (and I'm not much at UNIX), but when I tried the program, I got this message in Terminal: "/System/Library/PrivateFrameworks/ZeroLink.framework/Versions/A/ZeroLink (No such file or directory, errno = 2)
Trace/BPT trap
logout
[Process completed]"
I love the idea. I also had written an Applescript to do the same thing and found it equally inelegant.



[ Reply to This | # ]