diff --git a/ZYX-html-framework/a_test_ram.lua b/ZYX-html-framework/a_test_ram.lua index de9d601..1e07d9b 100644 --- a/ZYX-html-framework/a_test_ram.lua +++ b/ZYX-html-framework/a_test_ram.lua @@ -1,7 +1,7 @@ -- Scripts pour tester l'occupation méroire des différents modules -- source: -print("\n a_test_ram.lua zf190126.1117 \n") +print("\n a_test_ram.lua zf190126.1845 \n") test_ram_alarm1=tmr.create() test_ram_alarm2=tmr.create() @@ -32,15 +32,15 @@ tmr.alarm(test_ram_alarm2, 5*1000, tmr.ALARM_SINGLE, function() zram1=node.heap() -- dofile("telnet_srv2.lua") -- dofile("web_ide2.lua") --- dofile("web_srv.lua") + dofile("web_srv_test2.lua") -- dofile("set_time.lua") - dofile("web_html.lua") +-- dofile("web_html.lua") -- dofile("telnet_srv2.lc") -- dofile("web_ide2.lc") -- dofile("web_srv.lc") - dofile("set_time.lc") +-- dofile("set_time.lc") zram2=node.heap() end) diff --git a/ZYX-html-framework/web_srv2.lua b/ZYX-html-framework/web_srv2.lua index 64b02a0..f1a5d5b 100644 --- a/ZYX-html-framework/web_srv2.lua +++ b/ZYX-html-framework/web_srv2.lua @@ -1,6 +1,6 @@ -- petit script de serveur WEB avec Active Server Page ZYX -print("\n web_srv2.lua zf190126.1837 \n") +print("\n web_srv2.lua zf190126.1844 \n") -- send a file from memory to the client; max. line length = 1024 bytes! function send_file(zclient, zfilename) @@ -14,12 +14,17 @@ function send_file(zclient, zfilename) until not line file.close() else - zclient:send("

"..zfilename.." not found - 404 error.

Home
") + zclient:send("

"..zfilename.." not found - 404 error.

Home
") end + zfilename = nil + zclient = nil + line = nil + file = nil + end -srv = net.createServer(net.TCP) +srv = net.createServer(net.TCP,10) srv:listen(80, function(conn) conn:on("receive", function(client, request) _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") @@ -30,6 +35,7 @@ srv:listen(80, function(conn) print("path: ",path) print("vars: ",vars) +--[[ if not string.find(request, "/favicon.ico") then print("coucou") if (method == nil) then @@ -44,11 +50,25 @@ srv:listen(80, function(conn) end file_html=string.gsub(path, "/", "") print("file_html: ",file_html) - send_file(conn, file_html) +-- send_file(conn, file_html) +-- send_file = nil + +]] + + + conn:send("

ESP8266
Server is working!

\n\n") + file_html = nil + k = nil + v = nil + _GET = nil + method = nil + path = nil + vars = nil --- conn:send("

ESP8266
Server is working!

\n\n") - end +-- end + + end) conn:on("sent", function(c) c:close() end) end) diff --git a/ZYX-html-framework/web_srv_test.lua b/ZYX-html-framework/web_srv_test.lua new file mode 100644 index 0000000..0fa3d35 --- /dev/null +++ b/ZYX-html-framework/web_srv_test.lua @@ -0,0 +1,17 @@ +-- petit script de serveur WEB pour tester les fuite mémoire + +print("\n web_srv_test.lua zf190126.2014 \n") + +sv = net.createServer() + +function receiver(sck, data) + print(data) + sck:close() +end + +sv:listen(80, function(conn) + conn:on("receive", receiver) + conn:send("

ESP8266
Server is working!

"..tmr.now().."\n\n") +end) + + diff --git a/ZYX-html-framework/web_srv_test2.lua b/ZYX-html-framework/web_srv_test2.lua new file mode 100644 index 0000000..1ffd669 --- /dev/null +++ b/ZYX-html-framework/web_srv_test2.lua @@ -0,0 +1,24 @@ +-- petit script de serveur WEB pour tester les fuite mémoire + +print("\n web_srv_test2.lua zf190126.2051 \n") + +function receiver(sck, data) + print(data) + sck:close() +end + +sv = net.createServer() +sv:listen(80, function(conn) + + conn:on("receive", function(client, request) + print(request) +-- client:close() + conn:send("

ESP8266
Server is working!

"..tmr.now().."\n\n") + conn:on("sent", function(c) c:close() end) +end) + + +-- conn:on("sent", function(c) c:close() end) +end) + +