Re: detecting an active Internet connection
Re: detecting an active Internet connection
- Subject: Re: detecting an active Internet connection
- From: Donald Hall <email@hidden>
- Date: Tue, 26 Oct 2004 20:06:37 -0600
Title: Re: detecting an active Internet
connection
Nothing stops me from using SCNetworkCheckReachabilityByName(). I
was just experimenting with ping and wondered if I had missed
something. I suppose using it avoids linking against another
framework, but that is not a big deal. One place the ping way struck
me as useful would be in an AppleScript Studio application where it
would not be possible to use the other framework without going outside
AppleScript. In that case something like the following would
work:
try
set pingResult to do shell
script "ping -c1 www.apple.com"
on error errMsg
display
dialog errMsg -- unkown host message will appear here
end try
pingResult
-------------------------------
"PING www.apple.com.akadns.net (17.112.152.32): 56 data
bytes
64 bytes from 17.112.152.32: icmp_seq=0 ttl=46 time=253.447 ms
--- www.apple.com.akadns.net ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 253.447/253.447/253.447 ms"
-------------------------------------
Regards,
Don
On Mon, 25 Oct 2004 23:54:27 -0600,
Donald Hall <email@hidden> wrote:
> Looking back in the archives of this list, I have found several
schemes using
>
>
SCNetworkCheckReachabilityByName()
>
> to attempt to determine if the Internet was reachable without
> actually triggering a connection attempt.
>
> It seems to me that using "ping" through an NSTask
would also work. When I try
>
> ping -c1 www.apple.com
I would consider using SCNetworkCheckReachabilityXXX() a much more
'reliable' (wrong word, but something goes there) method than
hard-coding in a ping command and parsing the output.
Is there anything that is stopping you from using
SCNetWorkCheck...?
-Phil
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden