lua-users home
lua-l archive

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




On Fri, Jan 24, 2020 at 3:45 PM Sean Conner <sean@conman.org> wrote:
It was thus said that the Great Michal Kottman once stated:
> On Fri, Jan 24, 2020, 3:28 PM connor horman <chorman64@gmail.com> wrote:
>
> > I have a question. Would a socket api fall under this discussion for a
> > “Batteries” API. Having basic TCP and UDP (and maybe Bluetooth as well when
> > hardware supports it) would be rather useful, especially in making lua its
> > own standalone language.
>
> I must be missing something obvious, but what is wrong with LuaSocket?

  The most glaring problem (in my opinion) is that LuaSocket only supports
select() for event driven IO, and select() is about the worst event driver
API out there.  And there's no way (that I can see, as I'm looking at the
source code right now) to use a different event API (like poll(), epoll() or
kqueue(), depending upon the underlying operating system).

  I also think the API could be cleaner.  I haven't looked too deeply into
the differences between LuaSocket, luaposix (which include a networking API)
and my own org.conman.net module, but from what I've seen, they are all
quite different in their apprach, with the first two being more C'ish, and
the latter being more Lua'ish (in my opinion).

  But before we get there, I want to discuss wrappers for select().  Soon.
The C library for Cqueues contains a proper event driven library written ground up by William Ahern for use in Lua. It works with poll, epoll, kqueues and whatever-the-heck Solaris uses. It *doesn't* support IOCP for Windows. If we can add IOCP support then we have a superb socket library for all platforms. I found a library stuffed inside another project that claimed to be an epoll wrapper for IOCP. I can dig the info up if you like.
 
Russ

  -spc