[Q] Linux and localAddress

Hans-Martin Mosner hmm at heeg.de
Mon Oct 29 19:38:57 UTC 2007


Edgar J. De Cleene schrieb:
> Folks:
>
> I playing with Linux and wish know why World reportLocalAddress report
> 127.0.01 and ifconfig on Linux console gives me 192.168.1.4.
>
> The Linux is SimplyMepis 6.5, installing from his repositories ( via console
> synaptic package manager) brings me Squeak 3.8, and I figure out how
> transfer and run the 3.10 needed files
>
> The computer is on small Lan connected to router with Mac and Windows, so I
> could test Squeak 3.10 on the three systems.
>
> Any lead ?
>
>   
Others have already told you different tricks, here's one more:
When you execute
"(Socket newTCP connectToHostNamed: 'squeak.org' port: 80) localAddress"
you get the address of the interface which can be used to connect to
squeak.org.
So if your machine is connected to two local networks 192.168.1.x and
192.168.2.x you get back the address of the interface that is connected
to the internet (via some router/NAT gateway or whatever).
Of course, you should substitute some other address for squeak.org if
your network is not connected to the internet.
And if you're not a messie, you should clean up after yourself by
closing the open socket :-)

Cheers,
Hans-Martin



More information about the Squeak-dev mailing list