2019-01-09 00:23:30 -05:00
|
|
|
local minitel = require "minitel"
|
|
|
|
local tA = {...}
|
|
|
|
|
2019-12-16 01:09:56 -05:00
|
|
|
host, port = tA[1], tA[2] or 22
|
2019-01-09 00:23:30 -05:00
|
|
|
|
|
|
|
local socket = minitel.open(host,port)
|
|
|
|
if not socket then return false end
|
|
|
|
local b = ""
|
2019-12-16 01:09:56 -05:00
|
|
|
os.spawn(function()
|
|
|
|
repeat
|
|
|
|
local b = socket:read("*a")
|
|
|
|
if b and b:len() > 0 then
|
|
|
|
io.write(b)
|
|
|
|
end
|
|
|
|
coroutine.yield()
|
|
|
|
until socket.state ~= "open"
|
|
|
|
end)
|
2019-01-09 00:23:30 -05:00
|
|
|
repeat
|
2019-12-16 01:09:56 -05:00
|
|
|
local b = io.read()
|
|
|
|
if b and b:len() > 0 then
|
2019-01-09 00:23:30 -05:00
|
|
|
socket:write(b.."\n")
|
|
|
|
end
|
|
|
|
until socket.state ~= "open"
|