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

John Pfersich smalltalker2 at mac.com
Sun Mar 5 04:47:03 UTC 2017


You can always use OSProcess/CommandShell to run netstat on Linux and MacOS. Do a search for OSProcess for more information. 

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
>> 
>> 
>> 
>> 
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170304/11814cc7/attachment.html>


More information about the Squeak-dev mailing list