I've tried the following and it does not work as expected.
It should be a tcp to serial bridge and a console in parallel, but the console part interferes with the uart part.
(Every part for each own works)
s=net.createServer(net.TCP,3000)
s:listen(8007,function(c)
function s_output(str)
if(c~=nil) then c:send(str) end
end
uart.on("data",s_output,0)
c:on("receive",function(c,l)
uart.write(0,l)
end)
c:on("disconnection",function(c)
flashmode = 0
end)
end)
s:listen(2323,function(ct)
con_std = ct
function st_output(str)
if(con_std~=nil)
then con_std:send(str)
end
end
node.output(st_output, 0) -- re-direct output to function s_ouput.
ct:on("receive",function(ct,l)
node.input(l) -- works like pcall(loadstring(l)) but support multiple separate line
end)
ct:on("disconnection",function(ct)
con_std = nil
node.output(nil) -- un-regist the redirect output function, output goes to serial
end)
end)