net.socket:on() "sent" callback doesn't work
Posted: Tue Mar 21, 2017 1:50 pm
Hi!
Sorry for my english... I don't speak werry well.
I do some project with ESP12E module. I flash NodeMCU firmware from there: https://nodemcu-build.com/ and I write some code. On one ESP I create AP and others: end modules (now only one but I need to connect 80 and more) are clients. I can connect and send data to and from end modules but i have problem with close open sockets and after 55 connections I have ERROR "out of memory". On both sides (AP and clients) code is similiar:
Sending function:
Recive:
I try to debug but ESP doesn't go to
Sorry for my english... I don't speak werry well.
I do some project with ESP12E module. I flash NodeMCU firmware from there: https://nodemcu-build.com/ and I write some code. On one ESP I create AP and others: end modules (now only one but I need to connect 80 and more) are clients. I can connect and send data to and from end modules but i have problem with close open sockets and after 55 connections I have ERROR "out of memory". On both sides (AP and clients) code is similiar:
Sending function:
Code: Select all
function send_wifi(tekst,komenda,zmienna,ip)
ca=net.createConnection(net.TCP, 0)
ca:on("sent", function(sck, c) print("Send") sck:close() end)
ca:send("START".."="..tekst .. '=' .. komenda .. '=' .. zmienna .. '=END')
ca:connect(80,"192.168.1." .. ip)
end
Recive:
Code: Select all
sv = net.createServer(net.TCP)
sv:listen(80, function(conn)
local napis
conn:on("receive", function(conn, receivedData)
napis = receivedData
conn:close()
-- Other CODE
send_wifi(poczatek,warunek,urzadzenie,someIP)
I try to debug but ESP doesn't go to
Code: Select all
after sending data. What I'm doing wrong? ca:on("sent", function(sck, c) print("Send") sck:close() end)