Zig Version
0.17.0-dev.1245+efd6f190f
Steps to Reproduce, Observed Behavior, and Expected Behavior
Here's an example code. On Linux it's fine but errors on Windows
const std = @import("std");
const Io = std.Io;
const net = std.Io.net;
pub fn main(init: std.process.Init) !void {
const io = init.io;
const addr: net.IpAddress = .{ .ip4 = .unspecified(2345) };
const socket = try addr.bind(io, .{ .mode = .dgram, .protocol = .udp });
defer socket.close(io);
var buf: [1024]u8 = undefined;
_ = socket.receiveTimeout(
io,
&buf,
.{ .duration = .{ .raw = .fromMilliseconds(1000), .clock = .awake } },
) catch |err| switch (err) {
error.Timeout => {
std.debug.print("ok\n", .{});
return;
},
else => return err,
};
}
I did some digging and it turns out the problem comes from this fragment
.net_receive => |*o| {
// TODO integrate with overlapped I/O or equivalent to avoid this error
if (concurrency) return error.ConcurrencyUnavailable;
batchCompleteBlockingWindows(b, operation_userdata, .{
.net_receive = netReceiveWindows(t, o.socket_handle, o.message_buffer, o.data_buffer, o.flags),
});
},
from batchDrainSubmittedWindows function in Threaded.zig.
The comment suggests it will be fixed in the future but I still wanted to create this issue. Is there something I can use instead of receiveTimeout for now?
### Zig Version
0.17.0-dev.1245+efd6f190f
### Steps to Reproduce, Observed Behavior, and Expected Behavior
Here's an example code. On Linux it's fine but errors on Windows
```
const std = @import("std");
const Io = std.Io;
const net = std.Io.net;
pub fn main(init: std.process.Init) !void {
const io = init.io;
const addr: net.IpAddress = .{ .ip4 = .unspecified(2345) };
const socket = try addr.bind(io, .{ .mode = .dgram, .protocol = .udp });
defer socket.close(io);
var buf: [1024]u8 = undefined;
_ = socket.receiveTimeout(
io,
&buf,
.{ .duration = .{ .raw = .fromMilliseconds(1000), .clock = .awake } },
) catch |err| switch (err) {
error.Timeout => {
std.debug.print("ok\n", .{});
return;
},
else => return err,
};
}
```
I did some digging and it turns out the problem comes from this fragment
```
.net_receive => |*o| {
// TODO integrate with overlapped I/O or equivalent to avoid this error
if (concurrency) return error.ConcurrencyUnavailable;
batchCompleteBlockingWindows(b, operation_userdata, .{
.net_receive = netReceiveWindows(t, o.socket_handle, o.message_buffer, o.data_buffer, o.flags),
});
},
```
from `batchDrainSubmittedWindows` function in Threaded.zig.
The comment suggests it will be fixed in the future but I still wanted to create this issue. Is there something I can use instead of receiveTimeout for now?