Checking for internet access

Sarah Reichelt sarahr at
Wed Jan 16 18:43:02 EST 2002

OK, I've got this working under OS 9. It quits unexpectedly under OS X and I
haven't checked with any other platforms. Here is a slightly stripped down
version of my script:

on mouseUp
  put "" into fld 1 of cd 1
  open socket "" with message "openSock"
  send checkLink to me in 6 seconds
  send mouseUp to me in 300 seconds
end mouseUp

on openSock
  put "Link OK" into fld 1 of cd 1
  close socket ""
end openSock

on socketError
  put "Link down" into fld 1 of cd 1
end socketError

on checkLink
  if fld 1 of cd 1 is empty then
    put "Link down" into fld 1 of cd 1
  end if
end checkLink

I don't think the socketError handler ever gets called, so I just use the
delayed checkLink to see if the openSock has happened. This is the only way
I could find to check for a failure to connect. The open socket is very
quick if it works and doesn't tie up the computer even if it fails.

Thanks for everybody's ideas but it seems that my main difficulty was OS X.


> i can't really test this due to my dedicated connection (and i'm not about
> to unhook it cause i'm trying to see how long i can push this machine before
> it finally dies ;-)
> in the description for "open socket" it looks like scripts should keep
> running (so it states).. perhaps try using the message feature (i remember
> going to use this for my socket, but didn't really understand it at the
> time)
> ----- Original Message -----
>> That's what I would like to do. I just need to know HOW to do a
> non-blocking
>> request. What Revolution command will check in a non-blocking &
> non-crashing
>> manner.

More information about the Use-livecode mailing list