Left here for archival purposes.

User avatar
By Markus Gritsch
#6675 @picstart: Here is a slightly modified function from ThomasW (viewtopic.php?f=19&t=702&start=30#p4467) which quickly delivers a big file:
Code: Select allfunction testserver()
   local srv = net.createServer(net.TCP, 100)
   srv:listen(80, function(conn)
      conn:on("receive", function(conn, payload)
         local isopen = false

         conn:on("sent", function(conn)
            if not isopen then
               isopen = true
               file.open("bigfile.html", "r")
            end
            local data = file.read()
            if data then
               conn:send(data)
            else
               file.close()
               conn:close()
               conn = nil
            end
         end)

         conn:send("HTTP/1.1 200 OK\r\n")
         conn:send("Content-type: text/html\r\n")
         conn:send("Connection: close\r\n\r\n")
      end)
   end)
end
testserver()
User avatar
By picstart
#6686
@picstart: Here is a slightly modified function from ThomasW (viewtopic.php?f=19&t=702&start=30#p4467) which quickly delivers a big file:

Thank you this was very nice...I was overly concerned that this payload issue went unaddressed after 0.9.2....Code that worked with 0.9.2 now is working again.
The solution posted above works very well for lager files
Thank you
Has anyone found a way to upload a small jpg file via ex Lualoader 0.70?
Lualoader 0.70 works for textual files but that's about it.
User avatar
By alonewolfx2
#6689
picstart wrote:
@picstart: Here is a slightly modified function from ThomasW (viewtopic.php?f=19&t=702&start=30#p4467) which quickly delivers a big file:

Thank you this was very nice...I was overly concerned that this payload issue went unaddressed after 0.9.2....Code that worked with 0.9.2 now is working again.
The solution posted above works very well for lager files
Thank you
Has anyone found a way to upload a small jpg file via ex Lualoader 0.70?
Lualoader 0.70 works for textual files but that's about it.

Lua can't send jpeg files over tcp or any other protocol yet. You can upload with tftpd but you can't use :)