Re: Discovering the default gateway address
Re: Discovering the default gateway address
- Subject: Re: Discovering the default gateway address
- From: "R. Tyler Ballance" <email@hidden>
- Date: Sun, 4 Feb 2007 02:31:19 -0600
On Feb 4, 2007, at 12:36 AM, Kay Roepke wrote:
Take a look at the System Configuration framework: <file:///
Developer/ADC Reference Library/documentation/Networking/
Conceptual/SystemConfigFrameworks/index.html#//apple_ref/doc/uid/
TP40001065>.
It can be used to get at the necessary information. In addition to
that also take a look at the scutil command line tool, using that
to look at the various Setup:/ and State:/ properties should give
you a feel for what information you can retrieve.
If you want to do it in your own code (rather than using NSTask to
invoke scutil) have a look scutils source code at <http://
darwinsource.opendarwin.org/Current/configd-136.1/scutil.tproj/>
So the best chance I suppose is to rely on reading the keys from the
proper entry in the System Configuration framework? (it seems the
right key is: State:/Network/Global/IPv4)
This is acceptable I suppose, but I was hoping for a more
programmatic means of doing this (such as using sysctl(3) and the
flags from route(4), which doesn't seem to want to cooperate
regardless), but I guess relying on System Configuration isn't that
bad is it? :)
Cheers
R. Tyler Ballance: Lead Mac Developer at bleep. software
contact: email@hidden | jabber: email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden