Hi Dave,

This has been discussed many times on this list: check the archives and you'll find many posts with many solutions depending on possible firewalls and many other things. As for me I use the following script that feeds a Boolean global var allowing to know if the connection is running or not.
Sorry but I don't remember who wrote the basis ;-)

Le 30 nov. 07 à 17:25, Dave a écrit :

Is there a way to test if the machine you are running on currently connected to the Internet?

Thanks a lot
All the Best
Dave

constant kNotifyDelay = 10
constant kCheckDelay = 10
local lTestMessage
local lTestServer
--------------------------------------
on CheckForInternet
  NetConnectionTest --
  if "CheckForInternet" is not in the pendingMessages then
    send "CheckForInternet" to me in kCheckDelay seconds
  end if
end CheckForInternet
--------------------------------------
on NetConnectionTest
  if the DNSServers is empty then
    NetConnectionNotify false --
  else
    put 1 into lTestServer
open socket to line 1 of the DNSServers with message "NetConnectionSocketOpen" --
  end if
end NetConnectionTest
--------------------------------------
on NetConnectionSocketOpen pSocket
  send "NetConnectionNotify true" to me in kNotifyDelay milliseconds --
end NetConnectionSocketOpen
--------------------------------------
on socketError pSocket, pErrorString
if pSocket is line lTestServer of the DNSServers then NetConnectionNotify false --
end socketError
--------------------------------------
on socketTimeout pSocket
  if pSocket is line lTestServer of the DNSServers then
    NetConnectionNotify false --
    close socket pSocket
  else
    ##############
   -- for other possible connections
  end if
end socketTimeout
--------------------------------------
on NetConnectionNotify pStatus
  global gInternetConnected
  local tResult,tCommand
  -----
  if lTestMessage <> empty then
if line lTestServer of the DNSServers is among the lines of the openSockets then
      close socket line lTestServer of the DNSServers
    end if
    put pStatus into gInternetConnected
    -- check this boolean global to know internet status
    put empty into lTestMessage
    put empty into lTestServer
  end if
end NetConnectionNotify

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: [EMAIL PROTECTED]/
----------------------------------------------------------------


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to