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.

Ping IP doesn't work
#4
Thank You guys. I've tried the script, but now it always logs that the IP is connected even though it is on another network. I don't understand, if there is something I'm doing wrong? Here is the script:

Code:
function ping(ip)
  local res = os.execute('ping -c 2 -W 5 ' .. ip)
  return res == 0
end

ping('192.168.100.222')

if ping then
  log('Connected')
  log(ping)
  --grp.checkwrite('0/0/9', true)
else
  log('Disconected')
  --grp.checkwrite('0/0/9', false)
end

If I ping this IP from cmd the request times out and it is disconected, but if I run this script it says it is connected. Maybe I have to somehow decode the data from "res"?

This is what logs gives me:

Code:
Ping IP 08.08.2019 11:04:40
* string: Connected
Ping IP 08.08.2019 11:04:40
* function: 0xb6b9d158
Reply


Messages In This Thread
Ping IP doesn't work - by MantasJ - 08.08.2019, 07:30
RE: Ping IP doesn't work - by Daniel - 08.08.2019, 07:49
RE: Ping IP doesn't work - by admin - 08.08.2019, 07:49
RE: Ping IP doesn't work - by MantasJ - 08.08.2019, 08:10
RE: Ping IP doesn't work - by Daniel - 08.08.2019, 08:19
RE: Ping IP doesn't work - by MantasJ - 08.08.2019, 08:34
RE: Ping IP doesn't work - by AlexLV - 22.04.2020, 21:23
RE: Ping IP doesn't work - by admin - 23.04.2020, 05:07
RE: Ping IP doesn't work - by AlexLV - 23.04.2020, 08:16
RE: Ping IP doesn't work - by djaval - 24.04.2024, 08:05
RE: Ping IP doesn't work - by admin - 24.04.2024, 08:47

Forum Jump: