I’m writing a utility which checks whether a given port on my computer is open or not.
For example, if port 443 is open, I’d like to print it.
So far I have:
const std = @import("std");
const io = std.testing.io;
test "scan port 443 on localhost" {
const address = try std.Io.net.IpAddress.parseLiteral("127.0.0.1:443");
const stream = try std.Io.net.IpAddress.connect(address, io, .{ .mode = .stream, .protocol = .tcp });
//
}
but I’m not sure if this is right, and if it is, how to use the stream object.
Appreciate any pointers.