lua-users home
lua-l archive

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

> > > Why isn't there select() in luasocket?
> > The only use of select by a script would to find out which of several
> > sockets is ready for a given operation, thus alowing multiplexing. The
> > library provides poll for that, and soon multi-threading within Lua will
> > render this use less important.
> Oh please, don't shoot pthreads at this.  Is it that difficult to add
> for example a wait function that gets a list of sockets?  Polling is
> nearly useless for anything but embedded systems or DOS.  And timeouts
> add an artificial latency that only some applications may tolerate.

Oh please, better your tone. Some of us that are not native english
speakers might get offended by the (hopefully) aparent sarcasm of your
comments. Try also being less categorical with your statements, lest
they prove unwise.  

I understand the point you are trying to make, and I will think about a
nice and clean way to implement select. It is not as obvious at it may
seem, but then I am not God. See, I don't like select and I don't want
to use the same interface to the functionality it provides. Do you have
any suggestion (besides running toLua in /usr/include)?

> > If there is anything you can't do with the current API, please clarify
> > and I will try to help.
> I only had a short look on luasocket but I would say: wait for any one
> of two sockets to become readable ;-)

That has already been said, by me. If you take better look, you will see
that LuaSocket was created mainly to be used on the client side. The
original idea was to provide support for for HTTP, SMTP and FTP.
Server-side support is being improved with time.  

Someone asked about a HTTP server written in Lua. We might try something
like that soon, multi-threaded most likely. By then, maybe the select
(or whatever) function will be available.