01.07.2016, 07:54
This example comes from our partners, we haven't tested it locally. I've modified it to provide error reporting which can be seen in Alerts tab.
Put this into Common functions:
This goes into event script, make sure to modify cmd and ip:
Put this into Common functions:
Code:
function sendircmd(cmd, ip, port)
local sock, res, err
sock = require('socket').tcp()
sock:settimeout(3)
res, err = sock:connect(ip, port or 4998)
if res then
res, err = sock:send(cmd .. '\r')
if res then
res, err = sock:receive()
else
alert('send failed: ' .. tostring(err))
end
else
alert('connect failed: ' .. tostring(err))
end
sock:close()
return res, err
end
This goes into event script, make sure to modify cmd and ip:
Code:
cmd = 'sendir,1:1,1,37650,1,1,341,171,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,64,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,1520,342,85,21,3765'
res, err = sendircmd(cmd, '192.168.1.1', 4998)
log(res, err)