DNS_QUERY_FAILED in Windows Network

I try to use dns in conjunction with a dhcp. In some network I get error DNS_QUERY_FAILED when trying nx_dns_host_by_name_get()

I use the following code:


status = nx_dhcp_user_option_retrieve( &g_dhcp_client0, NX_DHCP_OPTION_DHCP_SERVER, dnsIpString, &dnsIpSize);

dnsIpAdr = nx_dhcp_user_option_convert( dnsIpString );

dnsIpAdr = __REV(dnsIpAdr);     // convert big endian to little endian

status = nx_dns_server_add(&g_dns0, dnsIpAdr);

status = nx_dns_host_by_name_get(&g_dns0, cloudSvrUrl, &cloudSvrIpAdr, 500);

    if(NX_SUCCESS != status) {
        g_ioport.p_api->pinWrite(Leds.p_leds[BSP_LED_LED2], IOPORT_LEVEL_LOW); // LED red
        printf(" ERROR: DNS Server add Error Code 0x%X \n", status);

in a case were

 assigned IP address
 assigned Netw Mask
 assigned Gateway address

1 DNS IP address

it works BUT if I have:

 assigned IP address
 assigned Netw Mask
 assigned Gateway address

 1 DNS IP address

Administrator told me that host name is wrong in DHCP/DNS

Please help

  • What is the topology of the network you are using? Is the DNS server the other side of a router?