Io module

resolve

procedureextensionexperimentalSource

Looks host up (an address literal, or a name for the system's resolver, which runs on a helper thread so only this fiber waits) and gives its first address, IPv4 preferred.

Example↗
Io :: #import "Extensions/Io";

Io.io_run(() {
    address, error := Io.resolve("127.0.0.1", 8080);
    assert(error == .NONE && address.port == 8080);

    host, _ := Io.resolve("localhost", 80);
    assert(host.family != .NONE);
});
resolve :: (host: string, port: u16) -> (Address, Io_Error)

Parameters

host: string
port: u16

Returns

See also