07.05.2019, 06:43
This is not a proper protocol implementation, but see if this works for you:
Code:
function openwebnetcmd(ip, cmd)
local socket = require('socket')
local eot = string.char(4)
local sock = socket.tcp()
sock:settimeout(1)
local res, err = sock:connect(ip, 20000)
if not res then
alert('connect failed ' .. tostring(err))
return
end
os.sleep(1)
sock:send('*99*0##' .. eot)
os.sleep(1)
sock:send(cmd .. eot)
os.sleep(1)
sock:close()
return true
end
openwebnetcmd('192.168.1.1', '*1*1*11##')