Sending UDP to global DNS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sending UDP to global DNS

Jump to solution
584 Views
skteh
Contributor III

Hi,

I have a problem to send an UDP packet to global DNS like Google DNS 8.8.8.8. I always get host unresolved error. When I try to send to local ip(my pc 192.168.10.76, my controller 192.168.10.10), I got no problem.

Can anyone please advice?

Thank you.

0 Kudos
1 Solution
419 Views
skteh
Contributor III

Hi David,

Thank for fast respond.

I just found my problem, I didn't enable gateway.

Now, I'm able to send UDP to internet already.

Thank you,

View solution in original post

0 Kudos
3 Replies
419 Views
frandelgado
Contributor I

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

0 Kudos
419 Views
DavidS
NXP Employee
NXP Employee

Hi SK,

It has been about a year since I did experiment with DNS.

I implemented it into the web_hvac demo project and tested with twr-k60d100m.

The files I enhanced to use the shell command line to test DNS are attached.

Note I was using MQX4.0.2.

Regards,

David

420 Views
skteh
Contributor III

Hi David,

Thank for fast respond.

I just found my problem, I didn't enable gateway.

Now, I'm able to send UDP to internet already.

Thank you,

0 Kudos