DNS under MQX issue

cancel
Showing results for 
Search instead for 
Did you mean: 

DNS under MQX issue

Jump to solution
987 Views
stephencox
NXP Pro Support
NXP Pro Support

Hello all,

I'm running MQX 4.1 on a TWR-K60F120M. I want to translate www.google.com to an IP address. To do that I'm enabling DNS. I want to make the DNS request to my router (wich is located at 172.16.0.1 --> 0xA1160001).

I define DNS parameters under source/if/dnshost.c the following way:

char DNS_Local_network_name[] = ".";

uint32_t DNS_CACHE_NAME_LIMIT = 0;

char DNS_Local_server_name[] = "";

DNS_SLIST_STRUCT DNS_Local_server_list[] =

   {{DNS_Local_server_name, 0, 0xAC160001, 0, 0, 0, 0,

     0, DNS_A, DNS_IN }};

DNS_SLIST_STRUCT      *DNS_First_Local_server = &DNS_Local_server_list[0];

Then I call DNS_init() in my code.

After that I call gethostbyname() as you can see next:

HOSTENT_STRUCT_PTR CPTServer;

printf("Initializing DNS service...");

if(DNS_init() != RTCS_OK) {

  printf("KO\n");

  _task_block();

}

printf("OK\n");

printf("Resolving google.com");

CPTServer = gethostbyname("www.google.com.");

if(CPTServer == NULL) {

       printf("KO\n");

       _task_block();

}

printf("OK\n");

The code is running with no problems. But, how can I extract the IP from CPTServer?

Thanks in advance.

scox

0 Kudos
1 Solution
422 Views
admin
Specialist II

Hi scox,

I have recently used RTCS shell example:

C:\Freescale\Freescale_MQX_4_1\rtcs\examples\shell

The _README.txt file is very clear and it explains all the example services including DNS. With this example I was able to solve www.google.com IP address.

I hope it helps.

Regards,

  Grant

View solution in original post

0 Kudos
1 Reply
423 Views
admin
Specialist II

Hi scox,

I have recently used RTCS shell example:

C:\Freescale\Freescale_MQX_4_1\rtcs\examples\shell

The _README.txt file is very clear and it explains all the example services including DNS. With this example I was able to solve www.google.com IP address.

I hope it helps.

Regards,

  Grant

0 Kudos