AnsweredAssumed Answered

Retrieving a second DNS server IP

Question asked by panpwr on Nov 11, 2012
Latest reply on Jan 28, 2014 by christophe michiels

Hello,

 

When I connect my laptop to the my office network, I receive 2 DNS addresses.

 

However, When I use my TWR-K60D100M, with the following code , I receive only one DNS address (I assume it should be stored automatically in the DNS list, once I get an IP using the DHCP client??):

 

/* Get IP address from DHCP server */

result = ipcfg_bind_dhcp_wait(BSP_DEFAULT_ENET_DEVICE, FALSE, NULL); //FALSE = don't bind static IP after failure

if (result == IPCFG_OK)

{

    is_successful = ipcfg_get_ip(BSP_DEFAULT_ENET_DEVICE, &ip_data);

    if (is_successful)

    {

        // Get DNS_1 server

        dns = ipcfg_get_dns_ip (BSP_DEFAULT_ENET_DEVICE, 0);

        if (dns != 0)

        {

          // THE FIRST DNS IS VALID!!!

        }

     

        // Get DNS_2 server

        dns = ipcfg_get_dns_ip (BSP_DEFAULT_ENET_DEVICE, 1); //<<=== This returns zero dns address, rather than the 2nd DNS which should  have been supplied by DHCP server.

    }

}

Outcomes