I\'m trying to get hold of the addresses to the currently used DNS servers in my application, either I\'m connected thru Wifi or mobile. The DhcpInfo object should provide t
A native alternative is:
char dns1[PROP_VALUE_MAX];
__system_property_get("net.dns1", dns1);
Or better yet for a comprehensive list:
for (i = 1; i <= MAX_DNS_PROPERTIES; i++) {
char prop_name[PROP_NAME_MAX];
snprintf(prop_name, sizeof(prop_name), "net.dns%d", i);
__system_property_get(prop_name, dns);
}
There are a few advantages to doing it this way: