[ANN] lsocket - Another library for sockets in lua

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[ANN] lsocket - Another library for sockets in lua

Gunnar Zötl
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.

You can get lsocket from http://www.tset.de/lsocket

or via luarocks install lsocket.

Rgds,

Gunnar

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Gunnar Zötl
I should add, as I have no windows to develop on, this is Linux and Mac only.

"Gunnar Zötl" <[hidden email]> hat am 27. März 2013 um 09:40 geschrieben:

> 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.
>
> You can get lsocket from http://www.tset.de/lsocket
>
> or via luarocks install lsocket.
>
> Rgds,
>
> Gunnar
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Egil Hjelmeland
> Also, everything (apart from select, and, if you wish to count them, dns
> resolutions) is non-blocking.

lsocket.connect() is blocking too?

If unix sockets also were supported, I could actually use it.

Egil


On 27. mars 2013 10:18, "Gunnar Zötl" wrote:

> I should add, as I have no windows to develop on, this is Linux and Mac only.
>
> "Gunnar Zötl" <[hidden email]> hat am 27. März 2013 um 09:40 geschrieben:
>> 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.
>>
>> You can get lsocket from http://www.tset.de/lsocket
>>
>> or via luarocks install lsocket.
>>
>> Rgds,
>>
>> Gunnar
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

steve donovan
On Wed, Mar 27, 2013 at 12:08 PM, Egil Hjelmeland
<[hidden email]> wrote:
> If unix sockets also were supported, I could actually use it.

Curiously enough, there's a parallel thread on the luarocks list about
the state of Lua networking libraries.

Innovation is great, but it's also worth concentrating some effort on
the standard libs.  There seems to be this idea that 'luasocket is
dead' because it isn't moving as fast as people want.  There are about
24 forks of luasocket on github, and no obvious way of finding out
what their state is.

Maybe Diego is simply too busy to continue being the maintainer?

Reply | Threaded
Open this post in threaded view
|

Checking for rocks up

Laurent FAILLIE
In reply to this post by Gunnar Zötl
Hi all,

Related to this announcement, I wonder if there is a way to check
automatically if installed rocks need to be updated ?

Thanks

Laurent

Le 27/03/2013 09:40, "Gunnar Zötl" a écrit :

> 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.
>
> You can get lsocket from http://www.tset.de/lsocket
>
> or via luarocks install lsocket.
>
> Rgds,
>
> Gunnar
>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Pierre Chapuis
In reply to this post by steve donovan
> On Wed, Mar 27, 2013 at 12:08 PM, Egil Hjelmeland

> Curiously enough, there's a parallel thread on the luarocks list about
> the state of Lua networking libraries.

s/rocks/jit/ [1], and you're right, we should discuss that here instead.

[1] http://www.freelists.org/post/luajit/FFI-cURL-and-function-callback,13

--
Pierre Chapuis


Reply | Threaded
Open this post in threaded view
|

Re: Checking for rocks up

steve donovan
In reply to this post by Laurent FAILLIE
On Wed, Mar 27, 2013 at 12:22 PM, Laurent Faillie <[hidden email]> wrote:
> Related to this announcement, I wonder if there is a way to check
> automatically if installed rocks need to be updated ?

Would be easy enough to automate for a _given_ rock.  First find out
current version:

~/lua/rockspec/examples$ luarocks list luafilesystem
Installed rocks:
----------------
luafilesystem
   1.5.0-1 (installed) - /home/azisa/.luarocks/lib/luarocks/rocks
   1.5.0-1 (installed) - /usr/local/lib/luarocks/rocks

then search the repo

~/lua/rockspec/examples$ luarocks search luafilesystem
Search results:
===============
Rockspecs and source rocks:
---------------------------
luafilesystem
   1.5.0-1 (src) - http://146.64.150.244/rocks
   1.5.0-1 (rockspec) - http://146.64.150.244/rocks
   1.4.2-1 (rockspec) - http://146.64.150.244/rocks
   1.4.2-1 (src) - http://146.64.150.244/rocks
   1.4.1-1 (src) - http://146.64.150.244/rocks
   1.4.1-1 (rockspec) - http://146.64.150.244/rocks
   1.4.0-2 (rockspec) - http://146.64.150.244/rocks

So in this case, no need to update.

Generally, it could be done with a plain 'list' and a 'search --all'
and a little Lua script...

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: Checking for rocks up

Dirk Laurie-2
In reply to this post by Laurent FAILLIE
2013/3/27 Laurent Faillie <[hidden email]>:

> Related to this announcement, I wonder if there is a way to check
> automatically if installed rocks need to be updated ?

"installed rocks need to be updated" is not an exact synonym
for "updates for installed rocks are available". For the latter,
you can do

luarocks search --all > allrocks.txt
luarocks list > installed_rocks.txt

and write a simple Lua script to check whether
each installed version is the most recent version.

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Gunnar Zötl
In reply to this post by Egil Hjelmeland
Hmmm... you're right, connect() may block, too. Not sure whether this can be
solved in the context of this rather simple API. Unix domain sockets are not
within the scope of this, but I hear that luasockets can do them now?

Egil Hjelmeland <[hidden email]> hat am 27. März 2013 um 11:08
geschrieben:

> > Also, everything (apart from select, and, if you wish to count them, dns
> > resolutions) is non-blocking.
>
> lsocket.connect() is blocking too?
>
> If unix sockets also were supported, I could actually use it.
>
> Egil
>
>
> On 27. mars 2013 10:18, "Gunnar Zötl" wrote:
> > I should add, as I have no windows to develop on, this is Linux and Mac
> > only.
> >
> > "Gunnar Zötl" <[hidden email]> hat am 27. März 2013 um 09:40 geschrieben:
> >> 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.
> >>
> >> You can get lsocket from http://www.tset.de/lsocket
> >>
> >> or via luarocks install lsocket.
> >>
> >> Rgds,
> >>
> >> Gunnar
> >>
> >
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Gunnar Zötl
In reply to this post by steve donovan
Just to be clear: I did not intend this to be a replacement for luasockets, it
can't be because luasockets is a rather complete api whereas this is not. It is
just a lightweight socket api to quickly get stuff done, without needing to
fiddle too much with the setup or stuff. The flipside is, that lsockets can't do
everything luasockets can do. But it isn't intended to.

steve donovan <[hidden email]> hat am 27. März 2013 um 11:16
geschrieben:

> On Wed, Mar 27, 2013 at 12:08 PM, Egil Hjelmeland
> <[hidden email]> wrote:
> > If unix sockets also were supported, I could actually use it.
>
> Curiously enough, there's a parallel thread on the luarocks list about
> the state of Lua networking libraries.
>
> Innovation is great, but it's also worth concentrating some effort on
> the standard libs.  There seems to be this idea that 'luasocket is
> dead' because it isn't moving as fast as people want.  There are about
> 24 forks of luasocket on github, and no obvious way of finding out
> what their state is.
>
> Maybe Diego is simply too busy to continue being the maintainer?
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Egil Hjelmeland
In reply to this post by steve donovan
On 27. mars 2013 11:16, steve donovan wrote:

> On Wed, Mar 27, 2013 at 12:08 PM, Egil Hjelmeland
> <[hidden email]> wrote:
>> If unix sockets also were supported, I could actually use it.
> Curiously enough, there's a parallel thread on the luarocks list about
> the state of Lua networking libraries.
>
> Innovation is great, but it's also worth concentrating some effort on
> the standard libs.  There seems to be this idea that 'luasocket is
> dead' because it isn't moving as fast as people want.  There are about
> 24 forks of luasocket on github, and no obvious way of finding out
> what their state is.
>
> Maybe Diego is simply too busy to continue being the maintainer?
>
>
I had similar thoughts, but I did not express them...

Egil


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

steve donovan
In reply to this post by Gunnar Zötl
On Wed, Mar 27, 2013 at 12:54 PM, "Gunnar Zötl" <[hidden email]> wrote:
> Just to be clear: I did not intend this to be a replacement for luasockets, it
> can't be because luasockets is a rather complete api whereas this is not.

Sorry, I did not intend it that way.  I suppose I am getting worried
about fragmentation again.

lsocket is a different animal, being mostly asynchronous.

Reply | Threaded
Open this post in threaded view
|

Re: Checking for rocks up

Lee Hickey
In reply to this post by steve donovan
On 27 March 2013 10:38, steve donovan <[hidden email]> wrote:
On Wed, Mar 27, 2013 at 12:22 PM, Laurent Faillie <[hidden email]> wrote:
> Related to this announcement, I wonder if there is a way to check
> automatically if installed rocks need to be updated ?

Would be easy enough to automate for a _given_ rock.  First find out
current version:

~/lua/rockspec/examples$ luarocks list luafilesystem
Installed rocks:
----------------
luafilesystem
   1.5.0-1 (installed) - /home/azisa/.luarocks/lib/luarocks/rocks
   1.5.0-1 (installed) - /usr/local/lib/luarocks/rocks

then search the repo

~/lua/rockspec/examples$ luarocks search luafilesystem
Search results:
===============
Rockspecs and source rocks:
---------------------------
luafilesystem
   1.5.0-1 (src) - http://146.64.150.244/rocks
   1.5.0-1 (rockspec) - http://146.64.150.244/rocks
   1.4.2-1 (rockspec) - http://146.64.150.244/rocks
   1.4.2-1 (src) - http://146.64.150.244/rocks
   1.4.1-1 (src) - http://146.64.150.244/rocks
   1.4.1-1 (rockspec) - http://146.64.150.244/rocks
   1.4.0-2 (rockspec) - http://146.64.150.244/rocks

So in this case, no need to update.

Generally, it could be done with a plain 'list' and a 'search --all'
and a little Lua script...

steve d.


How about luarocks adds two commands:

luarocks installed_version luafilesystem
luarocks latest_version luafilesystem

When building scripts to install dependencies on new machines, I currently have to cobble this sort of thing together on an ad hoc basis.

Incidentally, with the latest penlight installed through luarocks, I get this:
~$  luarocks list penlight

Installed rocks:
----------------

penlight
   scm-1 (installed) - /usr/local/lib/luarocks/rocks

which makes parsing the version a little tricky.
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Matthew Wild
In reply to this post by steve donovan
On 27 March 2013 10:16, steve donovan <[hidden email]> wrote:
> On Wed, Mar 27, 2013 at 12:08 PM, Egil Hjelmeland
> <[hidden email]> wrote:
>> If unix sockets also were supported, I could actually use it.
>
> Curiously enough, there's a parallel thread on the luarocks list about
> the state of Lua networking libraries.

Sounds like I ought to be there... :)

> Innovation is great, but it's also worth concentrating some effort on
> the standard libs.  There seems to be this idea that 'luasocket is
> dead' because it isn't moving as fast as people want.  There are about
> 24 forks of luasocket on github, and no obvious way of finding out
> what their state is.
>
> Maybe Diego is simply too busy to continue being the maintainer?
>

Prosody is desperate for a new LuaSocket release (many of the new
changes, including IPv6 support, came from the Prosody community). I
heard from Diego last week that he *is* intending to release real soon
now...

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

[ANN] lsocket - Another library for sockets in lua

liam mail
In reply to this post by steve donovan


On Wednesday, 27 March 2013, steve donovan <[hidden email]> wrote:
>
> Curiously enough, there's a parallel thread on the luarocks list about
> the state of Lua networking libraries.
>
> Innovation is great, but it's also worth concentrating some effort on
> the standard libs.

Lua has a networking library as part of the core or at least blessed ? When did this happen ?

-- Liam
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

steve donovan
On Wed, Mar 27, 2013 at 1:18 PM, liam mail <[hidden email]> wrote:
> Lua has a networking library as part of the core or at least blessed ? When
> did this happen ?

Certainly not in the core, and the concept of 'blessed' does not
operate in Lua land.

But, we're used to luasocket and it's a common library.  (I probably
should not use the word 'standard' here.)

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Pierre Chapuis
In reply to this post by liam mail
> On Wednesday, 27 March 2013, steve donovan <[hidden email]>

> Lua has a networking library as part of the core or at least blessed ?
> When did this happen ?

It's not part of the core but it's what most people use.
The fact that Diego Nehab used to be at PUC-Rio probably
plays a role in that. The fact that luasocket is used in PiL
too.

--
Pierre Chapuis


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Matthew Wild
In reply to this post by liam mail
On 27 March 2013 11:18, liam mail <[hidden email]> wrote:

>
>
> On Wednesday, 27 March 2013, steve donovan <[hidden email]>
> wrote:
>>
>> Curiously enough, there's a parallel thread on the luarocks list about
>> the state of Lua networking libraries.
>>
>> Innovation is great, but it's also worth concentrating some effort on
>> the standard libs.
>
> Lua has a networking library as part of the core or at least blessed ? When
> did this happen ?

It was blessed, by the community (though it won't be for much longer
if it doesn't keep up). I'm one of those who is glad that the Lua
authors do not bless third-party libraries, because that's not how
open-source works.

For Prosody we could have easily implemented our own C libraries by
now, but it seemed Wrong. There is an existing Lua networking
framework that includes more than just LuaSocket - also LuaSec and
LuaEvent. We've contributed heavily to all of these, both in features
and bug-fixing. Ultimately I like to think that this is moving Lua
forward (however painfully slow), as well as the individual libraries
themselves.

Nevertheless, we are nearing a (long overdue) release ourselves, and
the most important of its new features depend on new versions of these
libraries being released. If they aren't, we *will* unfortunately be
forced to fork - however as I said above, this is how open-source
works. Arbitrary 'blessings' from the Lua team would only hinder that.

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] lsocket - Another library for sockets in lua

Roberto Ierusalimschy
In reply to this post by liam mail
> > Innovation is great, but it's also worth concentrating some effort on
> > the standard libs.
>
> Lua has a networking library as part of the core or at least blessed ? When
> did this happen ?

I guess LuaSocket has been blessed by the community a long time ago.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: Checking for rocks up

Laurent FAILLIE
In reply to this post by Lee Hickey
I second also the suggestion to add something in luarocks for automatic
checking.
It's easier for users and wide spread in all packages management system.


12