Re: DHCP server address
Re: DHCP server address
- Subject: Re: DHCP server address
- From: Jens Bauer <email@hidden>
- Date: Sun, 2 Jun 2002 15:39:05 +0200
Hi Ryan,
On Sun, 2 Jun, 2002, Ryan McGann <email@hidden> wrote:
>
Quickie: Is there a way to obtain the IP address of the DHCP server?
I think the quick answer is: Yes.
Try looking at this code, which gets the current DNS address under Mac OS 9:
int GetCurrentDNS(char *buffer)
{
OSStatus err;
char *p;
InetInterfaceInfo info;
InetHost dns;
p = buffer;
if(p)
{
OTMemzero(&info, sizeof(info));
err = OTInetGetInterfaceInfo(&info, kDefaultInetInterface);
dns = info.fDNSAddr; /* you may want to change this line
(fDefaultGatewayAddr) */
sprintf(p, "%d.%d.%d.%d", (dns >> 24) &0xff, (dns >> 16) &0xff, (dns >>
8) &0xff, dns & 0xff);
return(1);
}
return(0);
}
-Note: You should not use the sprintf for converting it into a dotted-
decimal string.
Love,
Jens
--
Jens Bauer, Faster Software.
-Let's make the World better, shall we ?
_______________________________________________
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.