[squeak-dev] Figuring out external IP addresses of network interfaces
Edgar De Cleene
edgardec2005 at gmail.com
Sat Mar 4 20:21:11 UTC 2017
You could know your local and internet Ip
I have this in Work (PasteUpMorph)
"Report the public IP of this computer
| addrString m s stream |
stream := HTTPSocket httpGet: 'http://checkip.dyndns.com'.
stream upToAll: 'IP Address: '.
stream := stream upTo: $<.
addrString := stream upTo: $<.
m := RectangleMorph new
color: (Color r: 0.6 g: 0.8 b: 0.6);
extent: 118 at 36;
s := StringMorph contents: 'Public IP:'.
s position: m position + (5 at 4).
m addMorph: s.
s := StringMorph contents: addrString.
s position: m position + (5 at 19).
m addMorph: s.
self primaryHand attachMorph: m.
Transcript show: NetNameResolver localHostAddress printString
> On Mar 4, 2017, at 14:40, Hari Balaraman <hari.balaraman at icloud.com> wrote:
> Hi All,
> I was wondering if there is a way to figure out the IP addresses of various network interfaces on a host machine. I've looked at some traffic on the list from a few years ago (6-7 years ago) that appeared to indicate there was no way to do this. As far as I could tell, there was a workaround using (running regularly) shell script that would write interface information to a file that could then be scooped up by the image.
> I was wondering if things have changed.
> I'd like an application to be aware of and be able to provide the IP address and port it is listening on for requests from the outside world (not localhost.)
> Thanks in advance.
> Kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev