lev.listen_unix

lev

listen_unix(path, opts) -> listener, err

Create a bound listening Unix domain (AF_UNIX) stream socket

Creates and binds an AF_UNIX stream listener at path. A leading @ selects the Linux abstract namespace (no filesystem entry, auto-cleaned). Returns a listener object whose accept method yields until a client connects, returning a wrapped socket (no peer address for AF_UNIX). accept takes a timeout (number) or { timeout = N, cancel = token }. The accepted socket's getpeercred method returns pid, uid, gid of the connecting process, recorded at connect.

The listener has the methods of a TCP listener. An AF_UNIX socket has no address and port, so its getsockname returns nil, "not an IP socket".

Options: