How to check internet connection

Jim Ault JimAultWins at yahoo.com
Mon Oct 3 18:46:07 EDT 2005


Another version for the Mac (Ken's would not work for me)

function checkNetPing
  --Mac OSX 10.3.9 Rev 2.5.1  version of Ken Ray's script
  --  does a single ping and reports the status and elapsed time
  
  --> Make a new main stack
  --> paste this ENTIRE handler into the stack script, apply,
  -->      then type " checkNetPing()" into the msg box
  -->      and keep hitting the enterkey
  
  --using   ping   with switch c
  -->    -c 1  means one ping
  -->    -c 3  means 3 pings
  
  set the itemDelimiter to "%"
  put the ticks into startt
  put shell("ping  -c 1 google.com") into pingReport
  put the ticks into endd
  
  put last word of item 1 of pingReport into lostt   --> 0% packet loss
  if lostt=0 then;return ("UP  :-)  "     && endd - startt)
  else;               return ("Down   :-(  "&& endd - startt);end if

  -- caution:  if you use a numeric ip address
  --    and if 'Down', the handler takes 10 seconds to finish
  --    Using a named address may work better since
  --       if the internet is down,
  --       then your DNS server would
  --       most likely be down and
  --       you would get an immediate report = 'Down'
  
end checkNetPing

Jim Ault
Las Vegas

On 10/3/05 7:47 AM, "Ken Ray" <kray at sonsothunder.com> wrote:

> On 10/3/05 8:22 AM, "MITTAL Pradeep Kumar" <PradeepKumar.MITTAL at insead.edu>
> wrote:
> 
>> Hello,
>>  
>> I want to check from revolution desktop program to know whether the user
>> is connected to internet.
>>  
>> Could anyone please provide me the code or some guide to do this.



More information about the use-livecode mailing list