lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Jun 13, 2009, at 7:27 PM, Eike Decker wrote:

I am writing a tiny webserver which is now also supporting the
keepalive feature of HTTP/1.1.

In practice, I found it more convenient to handle such time out outside of Lua, i.e. using timelimit [1] or such.

For example, using tcpserver [2] and HTTP.lua [3]:

tcpserver -c 100 -qRHlOD 0 3388 timelimit 60 lua Nanoki.lua .

In other words, tcpserver will start a time limited Lua process for every new connection.

The above setup is how the online demo of Nanoki runs:

http://svr225.stepx.com:3388/

As far as select and coroutines go... such setup is of limited practical use if any of the coroutine starts doing any real work aside from waiting on the network... ymmv of course...

Cheers,

--
PA.
http://alt.textdrive.com/nanoki/

[1] http://devel.ringlet.net/sysutils/timelimit/
[2] http://cr.yp.to/ucspi-tcp/tcpserver.html
[3] http://dev.alt.textdrive.com/browser/HTTP/HTTP.lua