This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Resident script - IP watchdog
#8
You can use socketping function but with port set to 502 (default ModBus TCP port):
Code:
function socketping(ip, port, timeout)
  port = port or 80
  local sock = require('socket').tcp()
  sock:settimeout(timeout or 2)
  local res, err = sock:connect(ip, port)
  sock:close()
  
  return res, err
end

ip = '192.168.10.150'
if not socketping(ip, 502) then
  alert('device is offline')
end
Reply


Messages In This Thread
Resident script - IP watchdog - by sorin - 09.10.2017, 14:06
RE: Resident script - IP watchdog - by sorin - 09.10.2017, 14:45
RE: Resident script - IP watchdog - by sorin - 17.12.2017, 16:57
RE: Resident script - IP watchdog - by admin - 03.04.2018, 12:01
RE: Resident script - IP watchdog - by Daniel - 06.11.2019, 21:13
RE: Resident script - IP watchdog - by Daniel - 08.11.2019, 08:54
RE: Resident script - IP watchdog - by admin - 08.11.2019, 09:28
RE: Resident script - IP watchdog - by admin - 08.11.2019, 10:53

Forum Jump: