[Pharo-project] NetNameResolver localHostName - Mac OS always returns an ip address string
Hi, When I call the following on my Mac: NetNameResolver localHostName the result is an ip address string eg '192.168.4.174' Is there some configuration work required on the Mac to ensure that #localHostName returns a name rather than ip address. Currently: $ hostname Nick-Agers-MacBook-Pro2.local $ cat /etc/hosts cat /etc/hosts 127.0.0.1 localhost # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts I'd be happy with #localHostName returning the hostname or an entry in /etc/hosts I've tested on Pharo 1.1.1 & 1.2.1 both using a COG vm Thanks Nick
Hi Nick, I just read your message and we faced this problem with Jannik working on the implementation of the network library Ocean. Using the 4.2.5beta1U Squeak VM and 1.3 Pharo image, there is primitives in the Socket plusgin to achieve what you are looking for: hostname := String new: NetNameResolver primHostNameSize. NetNameResolver primHostNameResult: hostname. hostname I do not remember if these primitives are also present in CogVM. Hope it helps, #Luc 2011/4/26 Nick Ager <nick.ager@gmail.com>
Hi,
When I call the following on my Mac:
NetNameResolver localHostName
the result is an ip address string eg '192.168.4.174'
Is there some configuration work required on the Mac to ensure that #localHostName returns a name rather than ip address. Currently:
$ hostname Nick-Agers-MacBook-Pro2.local
$ cat /etc/hosts cat /etc/hosts 127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
I'd be happy with #localHostName returning the hostname or an entry in /etc/hosts
I've tested on Pharo 1.1.1 & 1.2.1 both using a COG vm
Thanks
Nick
participants (2)
-
Luc Fabresse -
Nick Ager