Perform a PING function with Basic

The eWON must often drop something on a server, but first thing to do is to know if this server is available.
To check such availability, we use the PING function to test the IP address of the targeted server.

eWON has no Ping function, but you can do a similar function with the Basic OPEN function.

Ping:  
	PRINT "ping ";Time$  
	CLOSE 1  
	ONSTATUS "goto ProcessStatus"  
	OPEN "tcp:10.0.120.122:80,10" FOR BINARY OUTPUT AS 1  
	a% = GETSYS PRG,"ACTIONID"  
END  
  
ProcessStatus:  
	PRINT "process ";Time$  
	b% = GETSYS PRG,"EVTINFO"  
	IF b%=a% THEN  
		SETSYS PRG,"ACTIONID",a%  
		c% = GETSYS PRG,"ACTIONSTAT"  
		IF c%=0 THEN  
			PRINT "PING 10.0.120.122:80 success"  
		ELSE  
			PRINT "PING 10.0.120.122:80 failed"  
		ENDIF  
		CLOSE 1  
	ENDIF  
END