| ... | @@ -4635,13 +4635,17 @@ fn netLookupFallible( | ... | @@ -4635,13 +4635,17 @@ fn netLookupFallible( |
| 4635 | var port_buffer_wide: [8]u16 = undefined; | 4635 | var port_buffer_wide: [8]u16 = undefined; |
| 4636 | const port = std.fmt.bufPrint(&port_buffer, "{d}", .{options.port}) catch | 4636 | const port = std.fmt.bufPrint(&port_buffer, "{d}", .{options.port}) catch |
| 4637 | unreachable; // `port_buffer` is big enough for decimal u16. | 4637 | unreachable; // `port_buffer` is big enough for decimal u16. |
| 4638 | for (port, port_buffer[0..port.len]) |byte, *wide| wide.* = byte; | 4638 | for (port, port_buffer_wide[0..port.len]) |byte, *wide| |
| | 4639 | wide.* = std.mem.nativeToLittle(u16, byte); |
| 4639 | port_buffer_wide[port.len] = 0; | 4640 | port_buffer_wide[port.len] = 0; |
| 4640 | const port_w = port_buffer_wide[0..port.len :0]; | 4641 | const port_w = port_buffer_wide[0..port.len :0]; |
| 4641 | | 4642 | |
| 4642 | const hints: ws2_32.ADDRINFOEXW = .{ | 4643 | const hints: ws2_32.ADDRINFOEXW = .{ |
| 4643 | .flags = .{ .NUMERICSERV = true }, | 4644 | .flags = .{ .NUMERICSERV = true }, |
| 4644 | .family = posix.AF.UNSPEC, | 4645 | .family = if (options.family) |f| switch (f) { |
| | 4646 | .ip4 => posix.AF.INET, |
| | 4647 | .ip6 => posix.AF.INET6, |
| | 4648 | } else posix.AF.UNSPEC, |
| 4645 | .socktype = posix.SOCK.STREAM, | 4649 | .socktype = posix.SOCK.STREAM, |
| 4646 | .protocol = posix.IPPROTO.TCP, | 4650 | .protocol = posix.IPPROTO.TCP, |
| 4647 | .canonname = null, | 4651 | .canonname = null, |