Getting a public IP address when connected to a router

Mike Bonner bonnmike at gmail.com
Tue Dec 14 09:11:27 EST 2010


On a mac you can do this..
get shell("ping -Rc 1 google.com| grep RR:")

The  line of the output starting RR: contains the external IP so it's
grepped for.
Easier to just hit a website that returns the info as stated, but thought
i'd throw this out there.
Pretty sure the same can be done with Windows ping, but not sure if the
switches are identical.


On Mon, Dec 13, 2010 at 10:11 PM, Terry Judd <tsj at unimelb.edu.au> wrote:

> OK - thanks Kee (and Sarah).
>
> Terry...
>
>
> On 14/12/10 4:06 PM, "Kee Nethery" <kee at kagi.com> wrote:
>
> > I agree with Sarah and to explain why ...
> >
> > When your computer is inside a firewall or gateway or router that does
> Network
> > Address Translation (NAT
> > http://en.wikipedia.org/wiki/Network_address_translation) there is no
> way to
> > know what your external address is because all your computer knows is
> it's
> > internal address and the internal address of the gateway that is
> connected to
> > the outside world.  You have to talk to a machine outside your private
> network
> > and ask it what it sees as your IP address. There are a bunch of web
> sites
> > that will tell you the external address for your computer. You'll need to
> > parse the HTML that comes back to you. Sarah provided one web site that
> I'm
> > sure works fine, there are tons of others. A search for "my ip address?"
> will
> > give you lots of web sites that can display your real external IP
> address.
> >
> > If your software really needs to know the external IP address and you do
> not
> > want to rely upon web sites created by others that you have to parse, you
> can
> > build your own web site and hit it. That way you can be sure that the web
> page
> > always gives you back the data in a format you can parse. Otherwise, when
> your
> > chosen external web site alters its HTML response, your code will break.
> >
> > Kee Nethery
> >
> >
> > On Dec 13, 2010, at 8:07 PM, Terry Judd wrote:
> >
> >> Does anyone have a LC routine (or tips on how to write one) that will
> enable
> >> me to get a public IP address rather than the local one assigned by a
> >> router?
> >>
> >> Terry...
> >>
> >> --
> >> Dr Terry Judd | Senior Lecturer in Medical Education
> >> Medical Education Unit
> >> Melbourne Medical School
> >> The University of Melbourne
> >>
> >>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> >> preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> >
> >
> > -------------------------------------------------
> > I check email roughly 2 to 3 times per day.
> > Kagi main office: +1 (510) 550-1336
> >
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription
> > preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> --
> Dr Terry Judd | Senior Lecturer in Medical Education
> Medical Education Unit
> Melbourne Medical School
> The University of Melbourne
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list