question

JamesHiggins-7505 avatar image
0 Votes"
JamesHiggins-7505 asked SatishBoddu-MSFT commented

Azure Sphere Application SDK - How to read current nameservers?

Our application requires the ability to display the active nameservers to the end user.

How can the active nameservers be read by the Azure Sphere Application code?

I have tried:

void GetNS(void)
{
int i;

 res_init();
 printf("_res.nscount %d\n", _res.nscount);
 for (i = 0; i < _res.nscount; i++)
 {
     struct sockaddr_in* addr = (struct sockaddr_in*)&_res.nsaddr_list[i];
     char* ip_address = inet_ntoa(addr->sin_addr);
     printf("**** Nameserver found: %s ***\n", ip_address);
 }

}

It always returns the nameserver count as 0 even though the network has valid nameserver settings assigned via DHCP.

This same code works on Linux and it returns the configured nameserver IP addresses.

azure-sphere
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @JamesHiggins-7505 Sorry for the delay in responding. Our team will be responding to your query soon.

0 Votes 0 ·

0 Answers