03.10.2024, 09:43
receive without timeout will wait until a new line (\n) character is received.
Try this script instead:
Try this script instead:
Code:
sock = require('socket').tcp()
sock:settimeout(10)
res, err = sock:connect('192.168.0.1', 23)
if res then
while true do
res, err, partial = sock:receive()
if res then
log('receive', res)
elseif partial then
log('partial', partial)
elseif err == 'closed' then
break
end
end
else
log('connect failed', err)
end
sock:close()