How to 'ping' a station

 

 

Pinging a station is an internet technique for sending a packet to a remote computer to check if it is operational. The exact same thing can be achieved on Econet using the machinepeek facility.

REM >PingRiscOS
REM
REM Pings a given station, parameters as set up.
REM Copyright © 1998 Richard Murray
REM
REM This version is for RiscOS machines ONLY.
REM
:
station% = 254  : REM Set your chosen station here
network% = 2    : REM Set your chosen network here
recurse% = TRUE : REM TRUE will keep pinging, FALSE will only ping once
rc% = 0
DIM buffy% 4
:
REPEAT
  SYS "Econet_DoImmediate", 8, 0, station%, network%, buffy%, 4, 1, 2 TO rc%
  IF (rc% <> 0) THEN
    PRINT "Failed - code "+STR$(rc%)
  ELSE
    PRINT "Ping successful - device ID &"+FNgetid
  ENDIF
UNTIL recurse% = FALSE
:
END
:
:
DEFFNgetid
  LOCAL out$
  out$ = RIGHT$("00"+STR$~(buffy%?1), 2)
  out$+= RIGHT$("00"+STR$~(buffy%?0), 2)
=out$


Return to econet index


Copyright © 1999 Richard Murray