[squeak-dev] Figuring out external IP addresses of network interfaces

David T. Lewis lewis at mail.msen.com
Sun Mar 5 14:47:46 UTC 2017


On Sat, Mar 04, 2017 at 08:47:03PM -0800, John Pfersich wrote:
> You can always use OSProcess/CommandShell to run netstat on Linux and MacOS. Do a search for OSProcess for more information. 
> 

As luck would have it, I just updated the SqueakMap entries for OSProcess
and CommandShell yesterday, so you can easily install them from SqueakMap.
Please use the latest versions of OSProcess/CommandShell regardless of what
version of Squeak you have.

Repositories:
  http://www.squeaksource.com/OSProcess
  http://www.squeaksource.com/CommandShell

Information:
  http://wiki.squeak.org/squeak/708
  http://wiki.squeak.org/squeak/1914
  http://wiki.squeak.org/squeak/6023

Dave


> Sent from my iPhone
> 
> > On Mar 4, 2017, at 12:21, Edgar De Cleene <edgardec2005 at gmail.com> wrote:
> > 
> > YES
> > You could know your local and internet Ip
> > 
> > I have this in Work (PasteUpMorph)
> > reportPublicIP
> > 	"Report the public IP of this computer
> > 	World reportPublicIP."
> > 
> > 	| addrString m s 	stream |
> > 	stream := HTTPSocket httpGet: 'http://checkip.dyndns.com'.
> > 	stream upToAll: 'IP Address: '.
> > 	stream := stream upTo: $<.
> > 	
> > 	Socket initializeNetwork.
> > 	addrString := stream upTo: $<.
> > 	m := RectangleMorph new
> > 		color: (Color r: 0.6 g: 0.8 b: 0.6);
> > 		extent: 118 at 36;
> > 		borderWidth: 1.
> > 	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.
> > 
> > For local
> >  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,
> >> 
> >> Hari
> >> 
> >> 
> >> 
> >> 
> > 
> > 

> 



More information about the Squeak-dev mailing list