lua-users home
lua-l archive

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

On Tue, Mar 24, 2009 at 1:49 PM, Ralph Hempel
<> wrote:
> Rob Kendrick wrote:
>> On Tue, 24 Mar 2009 09:41:12 -0700
>> "John Dunn" <> wrote:
>>> The goal is to allow our  users to write scripts which interact with
>>> devices on the network
>>>  (1) without having to learn the Berkley sockets interface
>>>  (2) ensure that their script don't block execution for too long a
>>> time
>>>  (3) without having to understand coroutines and yield()
>>>  (4) run on both Win32 and Linux platforms
>> This sounds almost precisely like what LuaSocket provides.  It's a
>> higher-level interface than Berkley (very easy to get going with),
>> supports non-blocking calls (ie, select), doesn't require you to use
>> co-routines, and works on Windows as well as Linux.
> I've used LuaSocket extensively to interface to a product
> that exposes an API over TCP and it's dead easy, customizable, and
> reliable.
> Using select() and some coroutine/yield magic might help in terms
> of CPU usage, but they are actually fairly easy to manage once you've
> used them a few times.
I suggest checking 'copas' it's a pretty useful companion to LuaSockets.

If those aren't your cup-of-tea... I suggest checking out libev and libevent ...
If you also want to be fast w/ Windows and use IOCP, there is a
libiocp out there (not sure if it's the fastest method) and I have
heard of libevent support for IOCP...maybe as a patchset...

If done right, you could write a C API merging the features of
libevent/libiocp/etc such that you can easily write a Lua API to it
and feed it necessary calls w/ callbacks/etc...

Thomas Harning Jr.