• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I find the device's Bonjour hostname?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I find the device's Bonjour hostname?


  • Subject: Re: How do I find the device's Bonjour hostname?
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Tue, 20 Dec 2016 17:56:15 +0000

On 20 Dec 2016, at 17:26, Jens Alfke <email@hidden> wrote:

> What’s the programmatic way to determine the localhost’s Bonjour hostname … ?

SCDynamicStoreCopyLocalHostName

> I’ve been doing this by calling gethostname() …

Yeah, that doesn’t work the way you’d like it to:

* The API spec for `gethostname` says nothing about DNS, so it could return something completely unrelated.

* The macOS implementation tries to come up with a reasonable DNS value based on the local network environment, but that means it’s not stable.  Back when I used to commute, I’d regularly see one value at work and a different value when I brought my laptop home.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How do I find the device's Bonjour hostname?
      • From: Jens Alfke <email@hidden>
    • Re: How do I find the device's Bonjour hostname?
      • From: Jens Alfke <email@hidden>
References: 
 >How do I find the device's Bonjour hostname? (From: Jens Alfke <email@hidden>)

  • Prev by Date: How do I find the device's Bonjour hostname?
  • Next by Date: Re: How do I find the device's Bonjour hostname?
  • Previous by thread: How do I find the device's Bonjour hostname?
  • Next by thread: Re: How do I find the device's Bonjour hostname?
  • Index(es):
    • Date
    • Thread