Re: Monitoring Network Status
Re: Monitoring Network Status
- Subject: Re: Monitoring Network Status
- From: Quinn <email@hidden>
- Date: Fri, 1 Feb 2002 09:39:17 +0000
At 14:25 -0500 31/1/02, email@hidden wrote:
I need to write some code that monitors the Mac's Internet
connectivity. That is, when the Mac connects to the Internet, I need
to be able to start things up, and then when it disconnects, shut
some things down. OSX seems to have some really great functionality
here in the form of the System Configuration Framework, and although
I've been able to make some things work by trial-and-error based on
the headers, I can't find any other documentation than the Framework
overview (which has no API details). Is there more/better
documentation somewhere??
No. In a short time I will release MoreSCF, a sample that shows how
to use SCF to programmatically set up network configurations.
However, this has very little info on the status monitoring side of
things. Doing that involves using the SCDynamicStore, which MoreSCF
hardly uses at all.
If you have SCF questions I'd be happy to take a stab at answering
them on this list.
Finally, have you discovered the scutil tool? This is a great little
command line utility that you can use to explore SCF, and especially
the dynamic store.
Also, this application needs to run under OS9 as well. Are there
OpenTransport API facilities similar to OSX's System Configuration
Framework, that I can use to request notifications for changes in
Internet connectivity? Can I do this as an InterfaceLib application
to support Macs running 8.x as well??
There are a bunch of facilities, but they're not as well coordinated
as SCF on Mac OS X.
o For a start you should probably take a look at DTS Technote 1145 "Living
in a Dynamic TCP/IP Environment". It's not really focussed on what
you want to do, but it references a lot of background info that you
will find useful.
<
http://developer.apple.com/technotes/tn/tn1145.html>
o Modern versions of OT support a notifier that's called when the TCP/IP
stack is reconfigured. TN 1145 includes a reference to this.
o Network Setup allows you to look at the configured state of the TCP/IP
stack, which is important because you'll need to determine the type
of link (PPP or Ethernet) that TCP/IP is using. The best way to learn
about this is MoreNetworkSetup. There is also formal documentation
for this.
<
http://developer.apple.com/samplecode/Sample_Code/Networking/
MoreNetworkSetup.htm>
<
http://developer.apple.com/techpubs/macos8/NetworkCommSvcs/
NetworkSetup/networksetup.html>
o If TCP/IP is using OT/PPP, you can use the OT/PPP API to determine
its connection state. There's documentation in the OT SDK. The
OT/PPP header is now rolled into "OpenTransportProviders.h" in
Universal Interfaces.
<
http://developer.apple.com/sdk/>
Since this version of the app won't run on OSX, would it be better
to do it with InterfaceLib or CarbonLib??
My general vote would be for InterfaceLib, but the real answer
depends on a variety of factors that are specific to your
application. If your application needs to use Carbon-specific
features (CarbonEvents, resource chain manipulation, and so on),
it'll have to be Carbon. You should note that Network Setup is not
available to CarbonLib applications, so you'd have to call it through
some sort of plug-in.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware