> On Jan 3, 2017, at 11:50 PM, Andreas Fink <af...@list.fink.org> wrote: > > I have a very weird situation where I installed a new mac by restoring a > timemachine backup of my previous mac. The hostname keeps coming back from > the old mac, despite the new name being set with the hostname command or with > the "Sharing" preference pane.
I had a similar situation a few weeks ago after changing my LAN to use a new router (supplied by AT&T.) It appears that the DHCP server in the router assigns a hostname to my computer for some reason, and this takes precedence over the Bonjour/mDNS hostname set in the Sharing system pref. What are you using the hostname string for? In my case I specifically need the mDNS (“.local”) hostname, so I switched to using a SystemConfiguration API call to retrieve it, instead of calling hostname(). —Jens
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to arch...@mail-archive.com