We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent feae50e commit 55d496dCopy full SHA for 55d496d
src/net/lib.zig
@@ -15,6 +15,19 @@ pub const Net = struct {
15
try rt.aio.queue_accept(index, socket);
16
}
17
18
+ pub fn connect(
19
+ self: *Net,
20
+ task_ctx: anytype,
21
+ comptime task_fn: TaskFn(i32, @TypeOf(task_ctx)),
22
+ socket: std.posix.socket_t,
23
+ host: []const u8,
24
+ port: u16,
25
+ ) !void {
26
+ const rt: *Runtime = @alignCast(@fieldParentPtr("net", self));
27
+ const index = try rt.scheduler.spawn(i32, task_ctx, task_fn, .waiting);
28
+ try rt.aio.queue_connect(index, socket, host, port);
29
+ }
30
+
31
pub fn recv(
32
self: *Net,
33
task_ctx: anytype,
0 commit comments