HostName(0)

BlitzMax Forums/BlitzMax Programming/HostName(0)

siread(Posted 2009) [#1]
Print HostName(0) returns nothing on my Mac (10.4). Works fine on Windows. Any ideas?


Arowx(Posted 2009) [#2]
Ditto here Mac (10.5.8) fine on Windows?


Brucey(Posted 2009) [#3]
Probably because 0.0.0.0 is not a valid address on Mac ?


SebHoll(Posted 2009) [#4]
Does this work?

Print HostName( HostIp("localhost") )



Arowx(Posted 2009) [#5]
That just prints localhost ;o)


xlsior(Posted 2009) [#6]
Does this work?

Print hostname(hostip("127.0.0.1"))


SebHoll(Posted 2009) [#7]
That just prints localhost ;o)

Strage - it doesn't on Windows... It prints the computer name (which I assume is what you are after). Hmmmm...


Brucey(Posted 2009) [#8]
Strage [sic] - it doesn't on Windows

Perhaps because Windows doesn't name localhost by default? I dunno.


xlsior(Posted 2009) [#9]
Perhaps because Windows doesn't name localhost by default? I dunno.


It does name localhost, but it's done through an alias in the hostfile for 127.0.0.1... I guess it simply re-directs 'localhost' to the local machine at a DNS level, but it doesn't inherently considers its name to be localhost.


Brucey(Posted 2009) [#10]
What about this?
SuperStrict

Framework BRL.StandardIO

Extern
	Function gethostname:Int(buf:Byte Ptr, length:Int)
End Extern

Local buf:Byte[100]

If Not gethostname(buf, buf.length) Then
	Print String.FromCString(buf)
End If




Arowx(Posted 2009) [#11]
Well that snippet does not work on windows but on my Mac it returns

MacMini.local

? If Not ?


Brucey(Posted 2009) [#12]
Well that snippet does not work on windows

Well, no. It wasn't intended to :-p


Arowx(Posted 2009) [#13]
:-P