Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QHostInfo::localHostName()
Qt 6.11 is out! See what's new in the release blog

QHostInfo::localHostName()

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    @QString lhname = QHostInfo::localHostName();@

    Does this function always return the same value on a given system?

    Example on my Mac, it always returns: My-Name-Mac.local

    On a Mac, what would cause the localHostName value to change? Isn't is supposed to be static and unchanging?

    Does this value return something different if you are logged on to the internet through a LAN versus just running your Mac locally without an internet connection? If so, why??

    For my Mac, I always get the same value returned regardless of whether I'm connected or not.

    On one or two other computer I run the same software on I get either...

    Some-Name-Mac.local
    or
    unknown-xx:xx:xx:xx:xx:xx-lan

    xx:xx:xx:xx:xx:xx being the MAC address of the computer in question. For some reason the the QString value returned by QHostInfo::localHostName() changes or toggles for no apparent reason.

    What am I missing? Any thoughts would be helpful.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      bump up

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved