Function connectUnixSocket [src]
Prototype
pub fn connectUnixSocket(path: []const u8) !Stream
Parameters
path: []const u8
Source
pub fn connectUnixSocket(path: []const u8) !Stream {
const opt_non_block = 0;
const sockfd = try posix.socket(
posix.AF.UNIX,
posix.SOCK.STREAM | posix.SOCK.CLOEXEC | opt_non_block,
0,
);
errdefer Stream.close(.{ .handle = sockfd });
var addr = try std.net.Address.initUnix(path);
try posix.connect(sockfd, &addr.any, addr.getOsSockLen());
return .{ .handle = sockfd };
}