I'm having some problems broadcasting data from the UART to the connected clients. Multiple clients seems to connect correctly with the ESP (I'm using the WEMOS D1 Mini Pro), but when I open the PuTTY or any other terminal, only one client can receive the data.
Say I'm getting data from my laptop. If another computer connects and opens the terminal, it gets the information from the ESP and my laptop stops receiving data (but still connected to the ESP's WiFi).
init = tmr.create()
init:register(5000, tmr.ALARM_SINGLE, function()
wifi.setmode(wifi.SOFTAP)
cfg={}
cfg.ssid="My_SSID"
cfg.pwd="password"
cfg.ip="192.168.0.1"
cfg.netmask="255.255.255.0"
cfg.gateway="192.168.0.1"
port = 9876 --tried telnet 23 also
wifi.ap.setip(cfg)
wifi.ap.config(cfg)
uart.setup(0, 921600, 8, 0, 1, 1)
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)
end)
init:start()
Already tried to write cfg.max = 4, but that didn't solve the problem. Why can't I send data to multiple clients?