Re: machine IP address
Re: machine IP address
- Subject: Re: machine IP address
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 25 Jul 2006 14:59:48 -0400
On 7/25/06, Bob Cuilla <email@hidden> wrote:
Does anyone know a good way to get the IP address?
"the" IP address? Which one?
First, a given machine doesn't have an IP address. Its various network
interfaces do. Most modern computers have at least a physical
Ethernet jack and a wireless (WiF/Airport) connection, either or both
may be active at any given time, with separate addresses.
Second, the IP address configured for a given interface on your Mac
may not correspond in any useful way to the IP address associated with
Internet traffic coming from (or destined for) it, depending on the
layout of your home network (if any), your ISP's network, etc.
If you want your local IP addresses and don't care about their
Internet addressibility, you can use "ifconfig" or "netstat -in" via
"do shell script", but you'll have to do some parsing to extract the
meaningful bits. You can try scripting System Preferences, but I've
never had any luck with that except for GUI scripting, and even if you
succeed you may only be able to get the IP address configured - if
you're using a dynamic IP assigned via DHCP, it may not be available
via System Preferences.
If you want to know what IP address the Internet sees, your best bet
is to script a web request of a page that tells you that information,
like http://checkip.dyndns.org/. There's probably a site out there
that offers "what's my IP?" as a Web Service so you could get it that
way rather than by HTML scraping.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden