It should be possible using the dynamic store of the System Configuration framework.
http://developer.apple.com/mac/library/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_Components/SC_Components.html#//apple_ref/doc/uid/TP40001065-CH207-CHDDDCHG The documentation says that this store contains a snapshot of the current configured networking preferences, and it's constantly being updated by various "Configuration Agents" as conditions change (location, for example). The documentation also outlines the system configuration schema which is the complex data structure that contains all networking settings, among other things. My problem is that the schema is so complex, I can't figure out how to use it properly to change the DNS settings. As far as my intent goes, it's nothing malicious. I would simply like to make my app always query the same set of DNS servers for speed/security reasons. This shouldn't be a shocker to anyone who has ever worked on high security applications. Any help would be appreciated. Thanks, Michael -- Michael Jackson http://mjijackson.com @mjijackson On Fri, Jul 2, 2010 at 11:33 AM, Jens Alfke <j...@mooseyard.com> wrote: > > On Jul 1, 2010, at 7:42 PM, Michael Jackson wrote: > >> Is there any way to bypass the system network preferences for DNS >> servers to perform all DNS lookups from within a Cocoa app? For >> example, I would like my app to always make DNS queries to a >> particular pair of DNS servers. > > I’m pretty sure that’s not directly possible, since DNS lookups are done by a > shared daemon process, not by individual apps. > > What you could do is incorporate direct DNS-lookup code into your app (I’m > sure there are open-source libraries for it), use that to resolve the > hostname to an IP address, and then use that IP address with your favorite > networking APIs instead of the hostname. (If you’re using NSURLConnection, > you’d need to transform the raw address into dotted-quad form, or the > equivalent for IPv6.) > > —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com