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 (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