net::unix
net::unix provides access to Unix sockets for networking.
A protocol provider for net::dial:: is provided by this module, but you must import net::unix at least once in order for it to be visible to net::dial.
Index
Types
type addr = str;
type backlog = u32;
type connect_option = net::sockflag;
type listen_option = (backlog | net::sockflag);
Errors
type invalid = !void;
Functions
fn accept(sock: net::socket, flags: net::sockflag = 0) (net::socket | net::error);
fn addfiles(buf: *net::msghdr, files: io::file...) void;
fn allocfiles(buf: *net::msghdr, nfile: size) void;
fn connect(addr: addr, options: connect_option...) (net::socket | net::error);
fn listen(addr: addr, options: listen_option...) (net::socket | net::error);
fn recvfiles(buf: *net::msghdr, nfile: size) []io::file;
fn socketpair(flags: net::sockflag = 0) ((net::socket, net::socket) | net::error);
Types
type addr
type addr = str;
A UNIX socket address.
type backlog
type backlog = u32;
Configures the backlog size for a listener. If not specified, a sensible default (10) is used.
type connect_option
type connect_option = net::sockflag;
Options for connect.
type listen_option
type listen_option = (backlog | net::sockflag);
Options for listen.
Errors
type invalid
type invalid = !void;
Invalid UNIX socket path.
Functions
fn accept
fn accept(sock: net::socket, flags: net::sockflag = 0) (net::socket | net::error);
Accepts the next connection from a socket. Blocks until a new connection is available. This is a convenience wrapper around net::accept.
fn addfiles
fn addfiles(buf: *net::msghdr, files: io::file...) void;
Adds a list of file descriptors to the ancillary data for a sendmsg operation.
fn allocfiles
fn allocfiles(buf: *net::msghdr, nfile: size) void;
Prepares an ancillary data buffer to receive files during a recvmsg operation.
fn connect
fn connect(addr: addr, options: connect_option...) (net::socket | net::error);
Opens a UNIX socket connection to the path. Blocks until the connection is established.
fn listen
fn listen(addr: addr, options: listen_option...) (net::socket | net::error);
Binds a UNIX socket to the given path.
fn recvfiles
fn recvfiles(buf: *net::msghdr, nfile: size) []io::file;
Receives files from an ancillary data buffer which was previously prepared with allocfiles.
fn socketpair
fn socketpair(flags: net::sockflag = 0) ((net::socket, net::socket) | net::error);
A thin wrapper around socketpair(2) that presumes rt::AF_UNIX for the domain and returns an unnamed pair of sockets of type rt::SOCK_STREAM.