Re: API for fetching the computer name in cocoa
Re: API for fetching the computer name in cocoa
- Subject: Re: API for fetching the computer name in cocoa
- From: Greg Guerin <email@hidden>
- Date: Fri, 12 Jun 2009 10:39:29 -0700
Eric Schlegel wrote:
However, be aware that [[NSHost currentHost] name] can block for an
exceedingly long time, so if you use it, always call it on a
thread; and some of other API recommended here, such as
SCDynamicStoreCopyComputerName, is probably a better choice.
And beware that "computer name" isn't necessarily the same as "host
name". There may be characters in the computer name that will be
transformed in order to make a valid mDNS hostname. For example, try
entering a comma in your computer name. mDNS wants what it wants.
Also beware that mDNS will uniquify the computer's hostname to avoid
name collisions. It typically does this by appending numbers.
Since the OP specifically asked for the displayable computer name,
not the hostname, I'm not sure how relevant this hostname tangent
is. Unless the OP really *did* want the hostname and was trying to
get there by going through the computer-name first.
-- GG
_______________________________________________
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