Re: Getting own IP address
Re: Getting own IP address
- Subject: Re: Getting own IP address
- From: "Peter Sichel" <email@hidden>
- Date: Wed, 30 Apr 2003 09:39:54 -0400
>
> Under OpenTransport/CFM, I get the following list:
>
>
>
> 24.95.76.171
>
> 127.0.0.1
>
>
>
> Upon further research, it looks like I'm only querying 1 interface, and
>
> its secondary addresses. I'll add the code to loop over all interfaces
>
> shortly.
>
>
I'm no expert, but can OT do that?
Mentat/TCP was designed as a source compatible
replacement for BSD Networking. It has always supported
multilink multihoming, multi-processing, etc.
The issue is what APIs Apple chose to publish. Under Mac OS 9
you can obtain interface information using the SIOCxxx ioctls,
or more simply Mentat's own Named Dispatch to request a formatted
report similar to ifconfig [similar to Quinn's DumpArpCache sample
code].
>
I know that OT has an implicit
>
"active interface" point of view, since it only supports one such, so I
>
don't know whether there's a way to get at all active interfaces.
The TCP/IP control panel and Preferences has an implicit "active
interface" point of view. On Mac OS X, the Mentat stack itself
is restricted to a single interface since its only purpose is
Classic compatibility. This means querying the classic stack
will not reveal the full network configuration of the machine.
You can verify this easily using IPNetTuner classic to examine
the ip_ipif_status report.
>
How do I get the IPs in the order the user sees them within
>
the Network preferences dialog?
The System Configuration Framework allows you to access
the Service Order information. If you are open to using
Cocoa, the System Configuration framework becomes easy to access.
CFDictionary, CFArray, and CFString can be simply type cast
to NSDictionary, NSArray, and NSString. If you prefer C++,
check out Quinn's MoreSCF sample code. [FYI: In my customers
testing, MoreSCFPortScanner.c still has some rare crashing bugs]
Kind Regards,
- Peter Sichel
Sustainable Softworks
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.