ComputerName() returns ComputerName.Router

Mac OSX specific forum
Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

ComputerName() returns ComputerName.Router

Post by Lebostein »

In my case ComputerName() returns "MacBook.local" on work and "MacBook.Speedport_Router_xyz" at home.

Is this a bug or an undocumented feature?
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

Re: ComputerName() returns ComputerName.Router

Post by wombats »

I don't know about PureBasic's function, but you can get a better version like this:

Code: Select all

host = CocoaMessage(0, 0, "NSHost currentHost")

hostName = CocoaMessage(0, host, "name")
string = CocoaMessage(0, hostName, "UTF8String")
Debug PeekS(string, -1, #PB_UTF8)

localisedName = CocoaMessage(0, host, "localizedName")
string = CocoaMessage(0, localisedName, "UTF8String")
Debug PeekS(string, -1, #PB_UTF8)

Debug ComputerName()
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ComputerName() returns ComputerName.Router

Post by mk-soft »

Thanks

The Purebasic version returns the wrong machine name when virtual machines are running.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply