lua-users home
lua-l archive

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


On Wed, Mar 27, 2013 at 09:40:46AM +0100, "Gunnar Zötl" wrote:
> Hi,
> 
> this message is to announce the availability of lsocket, another take of a
> socket programming library for lua.
> 
> It is not intended to be a complete socket api, but easy to use and good enough
> for most tasks. Both IPv4 and IPv6 are supported, as are tcp and udp, and also
> IPv4 broadcasts and IPv6 multicasts.
> 
> With lsocket, I restrict myself to what I percieve as the most common use cases
> of socket programming, and attempting to make those things
> easy. Also, everything (apart from select, and, if you wish to count them, dns
> resolutions) is non-blocking.

IMO, a sockets library cannot be non-blocking if the DNS is blocking.
Queries can often take several seconds to complete, or in some cases, never.
If you're concurrently servicing 100 or 1000 open connections (or more!),
blocking on DNS for 5 seconds, or just .5 seconds, is an absolute
non-starter. I work at a networking appliance and "cloud" company, and this
happens _all_ _the_ _time_, and almost invariably if the names aren't
cached. Out-of-bailwick SOAs are the norm, and they dramatically increase
resolution time.

I don't have the time to fix the Win32 build (it worked once-upon-a-time),
but you can try with this library:

	http://25thandclement.com/~william/projects/dns.c.html

It's a fully non-blocking DNS library, *without* any callbacks, so it's
rather trivial to integrate into Lua (as I did w/ my cqueues library).

The Enlightenment networking subsystem maintainer would be thrilled if you
actually patched it up to work on Windows again. (Windows isn't officially
supported by Enlightenment, but Nokia would prefer the toolkit be portable
to embedded Windows systems). The big ticket item needed for proper Windows
support is reading the current nameservers (when in non-recursive mode).
There are 3 or 4 different techniques floating around (using 2 or 3
different Windows APIs), and I haven't had the time to determine which is
the best or most appropriate.