tags:

views:

210

answers:

0

So I've got this code that does asynchronous DNS resolution using the ares library that I need to port to the iPhone. Getting the list of DNS servers on the desktop is straightforward,

SCDynamicStoreContext context = {0, NULL, NULL, NULL, NULL};
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL,CFSTR("init_by_defaults_systemconfiguration"), NULL, &context);
CFStringRef key = CFSTR("State:/Network/Global/DNS");
CFDictionaryRef dnsDict = SCDynamicStoreCopyValue(store, key);
CFArrayRef addresses = (CFArrayRef) CFDictionaryGetValue(dnsDict, kSCPropNetDNSServerAddresses);

... but the SCDynamicStore APIs aren't available on the iPhone and it's not immediately evident what an equivalent might be. Any suggestions?