for _, client in pairs(read) do
local input = client:recv(1000)
- if input == nil or input == "" -- the telnet client program has left
+ if input == nil -- the telnet client program has left
or ((client.type == host.client_type.net
or client.type == host.client_type.telnet)
and input == "\004") then
-- handle clients in read mode
for _, client in pairs(read) do
local str = client:recv(1000)
+ if not str then break end
str = string.gsub(str,"\r?\n$","")
client.buffer = "Got `"..str.."'.\r\n"
client:switch_status( host.status.write )