QHostInfo::localHostName()



  • @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.



  • bump up


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.