Io module

address_v4

procedure · 1 overloadSource

An IPv4 address from its four octets, a.b.c.d, and a port in host order. address_to_string turns it back into text.

Example
address := address_v4(127, 0, 0, 1, 8080);

assert(address.family == .IPV4);
assert(address.bytes[0] == 127 && address.bytes[3] == 1);
assert(address_to_string(address) == "127.0.0.1:8080");

Doesn't run in the browser (skipped on wasm).

address_v4 :: (a: u8, b: u8, c: u8, d: u8, port: u16) -> Address

An IPv4 address from its four octets, a.b.c.d, and a port in host order. address_to_string turns it back into text.

Parameters

a: u8
b: u8
c: u8
d: u8
port: u16

Returns

Example
address := address_v4(127, 0, 0, 1, 8080);

assert(address.family == .IPV4);
assert(address.bytes[0] == 127 && address.bytes[3] == 1);
assert(address_to_string(address) == "127.0.0.1:8080");

Doesn't run in the browser (skipped on wasm).

See also