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.