Re: [[NSHost currentHost] name] blocking on 10.6 ?
Re: [[NSHost currentHost] name] blocking on 10.6 ?
- Subject: Re: [[NSHost currentHost] name] blocking on 10.6 ?
- From: Keith Duncan <email@hidden>
- Date: Tue, 08 Sep 2009 23:21:01 +0100
While I don't speak for Apple, we ran into this with Daylite Server,
and found out that you shouldn't be using those calls.
I got a similar response, I had been using NSHost previously and
hadn't noticed any delay so assumed it was using a local backing
store. I ran the same code on the network at WWDC and observed one
minute plus delays as it waited for a multicast response.
This gave rise to my new rule, test all network applications under
WWDC network conditions, there's no replacement.
Basically, your computer is NOT the authority on your computer's
host name. The DNS system is the authority. So these calls tend to
trigger DNS lookups, at which point you're at the mercy of DNS,
especially badly configured DNS, or DNS servers that are down, or
what-have-you.
That's true. Perhaps the problem here lies in the interaction
between DNS and mDNS. I really just want my local mDNS name, nothing
more.
Perhaps it's worth noting that in 10.6 the DNS responder and
mDNSResponder are one in the same. It's now the system wide lookup
demon so that there's one authoritative local cache.
You haven't mentioned what you need the machine name for; as a
miscellaneous networking example you can pass NULL for the host
parameter to DNSServiceRegister which registers it for the current
host and tracks changes; depending on wether you need it to pass to
another API or if you need to display/otherwise use it you might get
away with nil/NULL.
Keith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden