lua-users home
lua-l archive

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


Hi,

i connected the unix-domain code in luasocket-2.0.2 to the
makefile[1], and i can build and require it, but i cannot
find any documentation on using it.  where can i find a
writeup on using AF_UNIX sockets with luasocket?  i need
to send strings to a spam-filter listening on some socket,
but i don't want any TCP overhead.

This is just an extension sample in the distribution. It's
not really widely used. LuaSocket only officially supports
things that can be done both on Windows and on Unix. There is no documentation because I thought it would save me
time. :) At any rate, it is completely analogous to TCP.

    -- send stdin through unix socket
    socket = require"socket"
    socket.unix = require"socket.unix"
    c = assert(socket.unix())
    assert(c:connect("/tmp/foo"))
    while 1 do
        local l = io.read()
        assert(c:send(l .. "\n"))
    end

Do you need more help?

Regards,
Diego