[squeak-dev] finding the unix localhost name

tim Rowledge tim at rowledge.org
Thu Mar 30 01:13:55 UTC 2023


We've had a few discussions about this issue over the years and never really decided on anything more certain than "er, well..."

There's certainly a bigger discussion around moving to the 'new networking' setting but for this one particular query it seems to me that using the code currently in NetNameResolver class>>#localHostName that gets ignored by the #useOldNetwork option is a good option. That is, 

localHostName
	"Return the local name of this host."
	"NetNameResolver localHostName"

	| host |
	host := String new: NetNameResolver primHostNameSize.
	NetNameResolver primHostNameResult: host.
	^host

returns a value that seems to be helpful, and that is retrieved via the unix function gethostname(), which is used by the hostname command. Are there any problems with the idea of using this?

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful random insult:- Mouth in gear, brain in neutral.





More information about the Squeak-dev mailing list