17.12.2017, 16:57
(17.12.2017, 08:08)kenjirosama Wrote: Hi
I have tried using this script to ping an Iphone but I always get back the same result regardless of it's presence in the network or not. The Iphone have a static IP.
Any ideas?
/K
Hi, The script is good, working.
Here mine looks:
Code:
function socketping(ip, port, timeout)
port = 80
local sock = require('socket').tcp()
sock:settimeout(2)
local res, err = sock:connect(ip, port)
sock:close()
return res, err
end
ip1 = '192.168.10.151'
ip2 = '192.168.10.152'
ip3 = '192.168.10.153'
ip4 = '192.168.10.154'
ip5 = '192.168.10.155'
ip6 = '192.168.10.156'
ip7 = '192.168.10.157'
if not socketping(ip1) then grp.write('10/5/1', true)
end
if not socketping(ip2) then grp.write('10/5/2', true)
end
if not socketping(ip3) then grp.write('10/5/3', true)
end
if not socketping(ip4) then grp.write('10/5/4', true)
end
if not socketping(ip5) then grp.write('10/5/5', true)
end
if not socketping(ip6) then grp.write('10/5/6', true)
end
if not socketping(ip7) then grp.write('10/5/7', true)
end
I have an IPAD an I have tried to ping from windows. If it is looked, doesn't reply to ping, if I unlocked start to reply.
Maybe it is a issue of replying to ping of the Iphone.