Accessing Current DHCP address/mask/gateway/DNS values

Discussion to talk about software related topics only.
Post Reply
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Accessing Current DHCP address/mask/gateway/DNS values

Post by sblair »

I'm trying to retrieve the current DHCP address, subnet mask, gateway, and DNS values from within a different task than what the DHCP client is running in. i.e. I need to get the current DHCP values to put in my display for the user.

I obviously don't want to create a new DHCP client object. How can I best access these values from within my Display Task?

I'm on a MOD5270 if that matters.

Thanks.
Scott
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Accessing Current DHCP address/mask/gateway/DNS values

Post by sblair »

Nevermind... I found the answer in this.

InterfaceBlock *ib = GetInterFaceBlock(InterfaceNumber);

iprintf("IP: "); ShowIP(ib->netIP); iprintf("\r\n");
iprintf("Mask: "); ShowIP(ib->netIpMask); iprintf("\r\n");
iprintf("Gate: "); ShowIP(ib->netIpGate); iprintf("\r\n");
iprintf("DNS: "); ShowIP(ib->netDNS); iprintf("\r\n");
Post Reply