29.10.2020, 14:21
(This post was last modified: 29.10.2020, 14:23 by Erwin van der Zwart.)
Hi,
Try this:
BR,
Erwin
Try this:
Code:
local host, port = "192.168.2.60", 23
local socket = require("socket")
local tcp = assert(socket.tcp())
tcp:connect(host, port)
tcp:settimeout(0.5)
--Set command
command = string.char(0xFF,0xFD,0x01) -- Do Echo
-- Write command
tcp:send(command .. '\r')
--or try Write command
--tcp:send(command)
--Get Reply
local s, status, partial = tcp:receive()
--Check if reply has a value
if s then
--Do your action(s) with replies
if s == string.char(0xFF,0xFC,0x01) then
log('Wont Echo')
end
loghex(s)
end
tcp:close()
Erwin