[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luasocket unix sockets
- From: William Ahern <william@...>
- Date: Mon, 31 Mar 2014 13:54:09 -0700
On Mon, Mar 31, 2014 at 04:10:34PM -0400, Sean Conner wrote:
> It was thus said that the Great Jim Rambo once stated:
> > Yes, I have that working.? I was just hoping for api info on the rest of
> > the function calls, parameters, return values, etc.? If not available, I
> > can infer from the source code and underlying unix function behaivior.
>
> It's a socket. Any of the calls you would do with a network connected
> socket, you can do with a Unix socket. There are some things you can do
> over a unix socket that you can't do over a network socket, like pass file
> descriptors and credentials (pid, uid, gid of sending packet) but that stuff
> tends to be a pain to use.
>
It's a pain to use in C, but it can be made simple from Lua. For example,
with my sockets module you can just do:
-- thread or process 1
local fp = io.open("/tmp/foo")
socket:sendfd("foo", fp)
-- thread or process 2
local _, fp = socket:recvfd()