lua-users home
lua-l archive

Re: [ANN] lua-handlers - async. tcp/udp sockets and HTTP requests.

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


On Tuesday 28, Ignacio Burgueño wrote:
> On Tue, Dec 28, 2010 at 1:14 PM, Robert G. Jakabosky
>
> <bobby@sharedrealm.com>wrote:
> > Hi Everyone,
> >
> > I would like to announce my latest project lua-handlers [1], an
> > asynchronous
> > socket & HTTP networking library that uses the lua-ev event loop.
>
> Nice! Just two questions. Is this intended for server side code? I didn't
> see an http server example or something like that.
The HTTP code only handles the client-side of HTTP requests right now. I 
might add support for server-side HTTP handling later, but it is a 
low-priority right now. Also currently there is no support for HTTPS, this 
is a nother low-priority feature for me.
The main reason I created this project was that I wanted to be able to send 
HTTP requests from a Lua Mongrel2 handler (Mongrel2 currently doesn't have 
support for allowing handlers to send internal/external HTTP requests). I 
will mostlikely port the Lua Mongrel2 bindings [1] to an async. interface.
> Also, what does the nixio-handler provide?
The nixio [2] TCP/Unix/UDP handlers where added after I sent that 
announcement. The nixio provides more posix interface to sockets & files 
then is provided by LuaSocket. I do a lot of C work so I prefer the nixio 
socket interface, but I will try to maintain both the LuaSocket & nixio 
socket interfaces.
Also another new feature added is a UDP acceptor (for nixio UDP sockets only 
right now). Now you can make a UDP server just like you would a TCP server 
(I don't mean having reliable message streams over UDP). Normally you can't 
call listen() & accept() on a UDP socket to create one connected socket for 
each client end-point taking with your UDP server. But there is a tricky way 
to emulate the accept() for UDP sockets. For some request/response based UDP 
server it is fine to just have one server-side UDP socket and use 
recvfrom()/sento() to process each request packet and send back a response 
packet (i.e. DNS). The recvfrom()/sendto() method can be harder to work with 
when making a stream based UDP service.
1. https://github.com/jsimmons/mongrel2-lua
2. http://dev.luci.freifunk-halle.net/nixio/doc/
3. https://github.com/saga/lua-handlers/blob/master/test_nixio_udp_server.lua
-- 
Robert G. Jakabosky

AltStyle によって変換されたページ (->オリジナル) /