[Newbies] How you could get your public IP from Squeak
tapplek at gmail.com
Mon Jun 25 16:28:11 UTC 2007
On Mon, Jun 25, 2007 at 07:36:28AM -0300, Edgar J. De Cleene wrote:
> My router is NOGA KN-S1060
> | stream wanIp |
> stream := HTTPSocket
> httpGet: 'http://192.168.1.1/sys_status.htm'
> args: nil
> user: 'admin'
> passwd: 'admin'.
> stream upToAll: 'wanIP'.
> wanIp := stream upTo: $;.
> ^ wanIp := (wanIp findTokens: '"') at: 2
> And I have a Mac , a Windows PC and a Linux box on my small LAN
> Perhaps this could be useful to some
Here is a variation that uses the public service dyndns:
| stream |
stream := HTTPSocket httpGet: 'http://checkip.dyndns.com'.
stream upToAll: 'IP Address: '.
^ stream upTo: $<
That page is tiny, and so is pretty quick to download and parse.
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808
More information about the Beginners