Ewon TechForum
Providing technical solutions to technical requests


Check if the Ewon is connected to the Internet or not
simon Offline
eWON Support
#1
Hi guys,

Here is a little function to check whether the Ewon is connected to the internet :

Code:
InternetStatus%= @CheckInternet%("tools.ewonsupport.biz")
IF InternetStatus% = 1 THEN
  PRINT "Internet ok"
ELSE
  PRINT "Internet Nok"
ENDIF

FUNCTION CheckInternet%($UrlorIp$)
CLOSE 1 
OPEN "tcp:" + $UrlorIp$ + ":443,2" FOR BINARY OUTPUT AS 1
$Result% = GETSYS PRG,"ACTIONID"

@WAITCUSTOM(3)

SETSYS PRG,"ACTIONID", $Result% 
$status% = GETSYS PRG,"ACTIONSTAT"
IF $status% = 0 THEN $CheckInternet% = 1 ELSE $CheckInternet% = 0
CLOSE 1 
ENDFN


FUNCTION WAITCUSTOM($timetowait%)
$starttime% = GETSYS PRG,"TIMESEC"
$Loop1:
  $temp% = GETSYS PRG,"TIMESEC"
    IF $temp% <$starttime% + $timetowait% THEN GOTO $Loop1
ENDFN
Reply



Possibly Related Threads…
26-06-2020, 11:50 AM
Last Post: simon
  Ewon Stops sending data Started by dlong0
7 Replies - 233 Views
24-06-2020, 09:47 AM
Last Post: simon
15-06-2020, 01:51 PM
Last Post: simon
18-05-2020, 05:25 PM
Last Post: simon
08-04-2020, 05:23 PM
Last Post: simon
  Creating Totaliser Within eWON Started by Josh
3 Replies - 1.421 Views
14-02-2020, 06:06 PM
Last Post: simon
  eWON and ThingWorx Started by simon
13 Replies - 7.293 Views
17-01-2020, 05:55 PM
Last Post: ltitel
07-01-2020, 03:34 PM
Last Post: simon
22-10-2019, 10:42 AM
Last Post: simon
03-09-2019, 02:08 PM
Last Post: simon



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy