Le 2 juil. 2010 à 19:33, Jens Alfke a écrit :

> 
> 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.)

FWIW, dig can do that, as you can specify a server when you use it to test DNS 
query:

http://www.opensource.apple.com/source/bind9/bind9-31/bind9/bin/dig/

-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to