const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
const address = try std.net.Address.resolveIp("127.0.0.1", 4221);
var listener = try address.listen(.{
.reuse_address = false,
});
try stdout.print("Started http server on port 4221", .{});
defer listener.deinit();
}
The exact error I run into is this.
❯ zig build run
run
└─ run http-server
└─ install
└─ install http-server
└─ zig build-exe http-server Debug native 1 errors
C:\Users\BINIT\scoop\persist\zigup\zig\0.14.0-dev.185+c40708a2c\files\lib\std\net.zig:756:5: error: std.net.if_nametoindex unimplemented for this OS
@compileError("std.net.if_nametoindex unimplemented for this OS");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
resolve: C:\Users\BINIT\scoop\persist\zigup\zig\0.14.0-dev.185+c40708a2c\files\lib\std\net.zig:614:46
resolveIp6: C:\Users\BINIT\scoop\persist\zigup\zig\0.14.0-dev.185+c40708a2c\files\lib\std\net.zig:103:48
4 reference(s) hidden; use '-freference-trace=6' to see all references
Zig Version
0.14.0-dev.185+c40708a2c
Steps to Reproduce and Observed Behavior
The exact error I run into is this.
For some reason it's still calling resolveip6 even after calling and supposedly returning ip4 at least that's what I could figure out which seems like it shouldn't be happening because ipv4 should be already resolved before it reaches resolveip6 https://github.com/ziglang/zig/blob/c40708a2ce4f6ed1adcc1de39fc7b4fc27db32f8/lib/std/net.zig#L66-L87
Expected Behavior
Not get compiler error.