Re: Discovering the default gateway address
Re: Discovering the default gateway address
- Subject: Re: Discovering the default gateway address
- From: Kay Roepke <email@hidden>
- Date: Sun, 4 Feb 2007 07:36:02 +0100
On Feb 4, 2007, at 3:47 AM, R. Tyler Ballance wrote:
Howdy, I'm trying to have my C/ObjC application discover the
default gateway address so I can perform some diagnostics
(including checking if the router supports UPnP and NAT-PMP, etc)
and I have a bit of C code (that doesn't work) so I'm curious as to
whether there is a higher level Cocoa abstraction that will return
this information to me?
NSWorkspace and NSHost don't seem to offer a means of obtaining the
information, and my C code returns a lot of entries (xxx.xxx.128.1)
but none that are my default gateway. Are there any higher level
abstractions through Cocoa that will return this information to me?
Hi!
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/>
HTH,
-k
--
Kay Röpke
http://classdump.org/
_______________________________________________
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