Not a big deal using:
srv=net.createServer(net.TCP, 28800)
srv:listen(port,function(conn)
uart.on("data", 0, function(data)
conn:send(data)
end, 0)
conn:on("receive",function(conn,payload)
uart.write(0, payload)
end)
conn:on("disconnection",function(c)
uart.on("data")
end)
end)
But I need to "do something" (reset other device) on every NEW connection to TCP (after reset device presents it's firmware revision etc). I've tried to use:
conn:on("connection",function(c)
do_reset()
but looks that it's NOT working (never enters into "do_reset()" function).
I can add "reset_needed flag" and do something on "receive" callback but it's called when something will arrive on TCP so it's NOT a solution. Any ideas how to do it?