How to check internet connection

Ken Ray kray at sonsothunder.com
Mon Oct 3 10:47:19 EDT 2005


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.

Here you go:

function checkNetStatus
  -- hide shell activity from user
  set the hideConsoleWindows to true

  -- ping a host that should always
  -- visible to your computer
  get shell("ping 24.10.72.1 -n 1 -w 200")

  -- isolate the status info
  put lineoffset("% loss",it) into x
  set the itemDelimiter to "="
  get word 1 of last item of line x of it

  -- tell somebody!
  if it <> 1 then
    return "UP"
  else
    return "DOWN"
  end if
end checkNetStatus

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list