19.10.2023, 09:09
You should use this script: https://forum.logicmachine.net/showthread.php?tid=4288
Modify the handler function in the resident script to alert IP/port for each connection:
Modify the handler function in the resident script to alert IP/port for each connection:
Code:
local function handler(sock)
local ip, port = sock:getpeername()
alert('modbus connection from: %s:%d', ip, port)
copas.setErrorHandler(log)
sock = copas.wrap(sock)
sock:settimeout(60)
while true do
local res, err = mb.tcphandler(sock)
if not res then
break
end
end
sock:close()
end