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: "email@hidden" <email@hidden>
- Date: Tue, 8 Sep 2009 22:37:14 +0100
On 8 Sep 2009, at 22:24, Jens Alfke wrote:
On Sep 8, 2009, at 1:15 PM, email@hidden wrote:
I am not sure if this is a problem unique to me or not but under
10.5 [[NSHost currentHost] name] or [[[NSProcessInfo] processInfo]
hostname] were quick and easy ways to get an mDNS friendly hostname
such as imac-2.local
On 10.6 I find that both these combinations block badly
(NSProcessInfo merely defers to NSHost I think).
This has always been a blocking API — as you saw, it calls into the
low-level synchronous DNS function getnameinfo().
I only started poking into it when it started to cause an issue. It
was certainly news to me that it could block.
And it doesn't necessarily return an mDNS-style ".local" hostname,
either. If there's a regular DNS hostname entry for your machine,
you'll get that instead, although in my experience it's usually
something uninteresting like "dhcp-123-12-34-56.intranet.bigcorp.com".
Thanks for that. I had presumed otherwise.
If you really want the locally-set 'sharing name', the
SCDynamicStore call seems like a good bet.
(Follow-ups should probably go to the macnetworkprog or bonjour-dev
lists, as this isn't really a Cocoa question.)
True. But hopefully a useful Cocoa posting too for anyone else using
NSHost whose app exhibits narcolepsy on 10.6
Thanks for the reply.
—Jens
Jonathan Mitchell
Developer
http://www.mugginsoft.com
_______________________________________________
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