Getting your Gateway IP Address
Getting your Gateway IP Address
- Subject: Getting your Gateway IP Address
- From: Mark Thomas <email@hidden>
- Date: Wed, 25 Oct 2006 12:33:17 +0100
- Organization: Coderus Ltd
Hi All,
Does any know how you would get your Gateway/Router IP address. As getting
this previously using Open Transport was pretty easy as you would use.
InetInterfaceInfo info;
OTInetGetInterfaceInfo ( &info, kDefaultInetInterface );
And then looking at the 'fDefaultGatewayAddr' which would give this
information. But as Open Transport is slowly going away, I'm looking to how
you do this in the bsd layer.
Usually the OTInetGetInterfaceInfo equivalent searching archives is using
'getifaddrs' which does return
struct ifaddrs *ifa_next; /* Pointer to next struct */
char *ifa_name; /* Interface name */
u_int ifa_flags; /* Interface flags */
struct sockaddr *ifa_addr; /* Interface address */
struct sockaddr *ifa_netmask; /* Interface netmask */
struct sockaddr *ifa_broadaddr; /* Interface broadcast address
*/
struct sockaddr *ifa_dstaddr; /* P2P interface destination */
void *ifa_data; /* Address specific data */
Which covers most IP information but there's nothing for gateway/router
address, also running ifconfig, which I assume using this information and
displaying doesn't show what I need.
Any idea's
Thanks
Mark.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden