Re: Check for an internet connection?
Re: Check for an internet connection?
- Subject: Re: Check for an internet connection?
- From: "John C. Welch" <email@hidden>
- Date: Mon, 24 Feb 2003 14:20:25 -0500
On 02/21/2003 09:33, "Mark Butcher" <email@hidden> wrote:
>
>
On Thursday, Feb 20, 2003, at 17:37 US/Pacific, Andy Ihnatko wrote:
>
>
> What's the simplest way to check if the internet is reachable? I'm
>
> building a new version of my AS Studio blogger app. When the time
>
> comes to post an item, I'd like it to be smart enough to say "You're
>
> not connected to the 'net. Would you like to cache it for later?" if
>
> necessary.
>
>
>
> For now, I call a shell script that pings the server, but I sense that
>
> a better solution is out there. Ideas?
>
This checks the status of Internet Connect:
>
>
tell application "Internet Connect"
>
state of (status of current configuration)
>
end tell
>
(*
>
0=idle
>
1=connecting
>
2
>
3
>
4=connected
>
5=disconnecting
>
*)
>
>
MarkB
However, that doesn't tell you anything other than Internet Connect has a
connection to *something. That something is the internal port on your cable
/ DSL modem, or your dialup provider. It will tell you nothing past that.
Oddly enough, your ping method is the best one to test if you have a
connection to the *Internet* and can see your server.
The only downside to this is of course that if you are traveling, many
places block pings. Nslookup isn't an option, as that tells you nothing
about status. A sample curl would be a better bet perhaps?
john
--
"We want to be in a situation under maximum pressure, maximum intensity, and
maximum danger. When it's shared with others, it provides a bond which is
stronger than any tie that can exist."
- SEAL Team Six Officer
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.