On 8 Sep 2009, at 22:24, Jens Alfke wrote:


On Sep 8, 2009, at 1:15 PM, jonat...@mugginsoft.com 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 (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

Reply via email to