What causes pause when pinging?

Björnke von Gierke bvg at mac.com
Mon Dec 30 06:49:00 EST 2002

I always tested the existence of a internet connection with this:

on mouseUp
   set the cursor to watch
   put URL "http://www.google.com" into field "test"
   if the result is not empty then
     put the result into field "test" -- error message
     put "connection successful" into field "test"
   end if
end mouseUp

note that you could check non blocking with this, but it does not 
always return an error (don't know why, maybe my fault):

on mouseUp
   open socket "www.google.com:80" with message connected
end mouseUp

on connected IP
   close socket IP --don't forget this, I once had a stack with 29 
connections open ;)
   put "connection successful" into field "test"
end connected

on socketError IP,error --not extremely reliable, sometimes nothing 
   put IP && error into field "test"
end socketError

on socketTimeout IP -- probably lagging connection (wanna retry?)
put  IP && "error: Timeout" into field "test"
end socketTimeout

On Montag, Dez 30, 2002, at 04:11 Europe/Zurich, RGould8 at aol.com wrote:

> I've got a revolution app that does a simple
> do field "runscript" as Applescript
> and then that field has:
> shell "ping -c 1 www.apple.com"
> I then take the result and display it.  The question I have is that 
> sometimes this call takes a very long time. (15-20 seconds).  Part of 
> the reason I'm doing this ping is to see if the network is active and 
> that the user can reach the outside world.  (perhaps there's a better 
> way to do this?)  If the user's network isn't up, then I would expect 
> the ping to come back with "unknown server" quite quickly.  I'm 
> wondering if the delay is due to the ping-command when launching from 
> Unix, because I notice that sometimes the terminal window freezes for 
> a bit until the ping response comes back.  Is there a way to kind of 
> "off-load" this ping process and permit Revolution to churn on other 
> things, or is it stuck because I'm launching this via Applescript?  If 
> so, will the new Rev 2.0 solve this problem via the shell command that 
> works on OS X?

More information about the Use-livecode mailing list