[squeak-dev] finding the unix localhost name
jakres+squeak at gmail.com
Thu Mar 30 06:32:39 UTC 2023
I cannot contribute to the concrete question, but note that a host can have
multiple addresses and can therefore be reachable under multiple host
names. Depending on what you try to do, it may matter and you better check
that you actually get the name that you expect in your production
tim Rowledge <tim at rowledge.org> schrieb am Do., 30. März 2023, 03:14:
> 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,
> "Return the local name of this host."
> "NetNameResolver localHostName"
> | host |
> host := String new: NetNameResolver primHostNameSize.
> NetNameResolver primHostNameResult: 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 Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Useful random insult:- Mouth in gear, brain in neutral.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev