How you could get your public IP from Squeak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How you could get your public IP from Squeak

Edgar J. De Cleene
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

Edgar


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How you could get your public IP from Squeak

Tapple Gao
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:

getPublicIP
| 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
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How you could get your public IP from Squeak

Edgar J. De Cleene



El 6/25/07 1:28 PM, "Matthew Fulmer" <[hidden email]> escribió:

> Here is a variation that uses the public service dyndns:
>
> getPublicIP
> | 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.

Very nice Matthew !


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners