add license
add github mirror
ignore source rocks
A Lua module that exposes the socket99 C library in Lua, making it easier to create TCP/UDP/Unix Domain client and server sockets.
Via Luarocks:
$ luarocks install luasock99
Assuming local sock99 = require 'sock99'. You can check out the tests for actual examples of using the API.
open(t)Open the socket as configured by table t, which may have the following fields:
listen instead of connect).It returns the file descriptor (integer) on success, or nil followed by a system-specific error message and error code on error. The file descriptor can be used with the standard POSIX calls (e.g. with luaposix: posix.unistd.close, posix.sys.socket.send, etc.).
Note that this is a raw integer, as such it cannot install a garbage collector finalizer to close itself - it must be closed explicitly.
TODO: for Lua 5.4, set a metatable with __close method.
Clone the project and install the required development dependencies:
If like me you prefer to keep your dependencies locally, per-project, then I recommend using my llrocks wrapper of the luarocks cli, which by default uses a local lua_modules/ tree.
$ llrocks install ...
To run tests:
$ llrocks run test/*.lua
The BSD 3-clause license for the Lua module. For the socket99 C library, see the deps/socket99/socket99.c header.