connectUnixSocket
Function parameters
Parameters
- path:[]const u8
Type definitions in this namespace
Types
Functions in this namespace
Functions
- tcpConnectToHost
- All memory allocated with `allocator` will be freed before this function returns.
- getAddressList
- Call `AddressList.deinit` on the result.
Error sets in this namespace
Error Sets
= switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }
Values
- has_unix_sockets
- = switch (native_os) { .windows => builtin.os.version_range.windows.isAtLeast(.win10_rs4) orelse false, .wasi => false, else => true, }
Source
Implementation
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 Address.initUnix(path);
try posix.connect(sockfd, &addr.any, addr.getOsSockLen());
return .{ .handle = sockfd };
}