I have a problem with dns, dns did not work. I have the k60 module with MQX 3.7 operating system. The dns's introduce this:
while (DNS_init ()! = RTCS_OK)
{
_time_delay (1000);
}
strcpy (string, "google.com.");
host = gethostbyname (string);
while (host == NULL)
{
if (host! = NULL) {
name = host-> h_name;
alias1 = host-> h_aliases [0];
name2 = host-> h_aliases [1];
type = host-> h_addrtype;
length = host-> h_length;
ipDNS = * (uint_32_ptr) host-> h_addr_list [0];
}
host = gethostbyname (string);
}
When initializing the ethernet I have to call the function ipcg_add_dns?
ipcfg_init_device (DEMOCFG_DEFAULT_DEVICE, address);
_ip_address DNS_server_ipaddr;
DNS_server_ipaddr = inet_addr ("8.8.8.8");
if (ipcfg_add_dns_ip (DEMOCFG_DEFAULT_DEVICE, DNS_server_ipaddr) == TRUE)
{
printf ("DNS added ok");
} else {
printf ("DNS added NOT ok");
}
In addition to the file dnshosts.c must configure something?
thank you