ark::net::inet_address class

denotes an IPV4 network address

Base classes

template<class SockAddr, clinux::sa_family_t AddrFamily>
class address_with_family<clinux::sockaddr_in, AF_INET>
Provides common members and types for network address of specific address family.

Public static functions

static auto from_address(address addr) -> result<inet_address> noexcept
downcast from an address

Public functions

auto host() const -> result<string> noexcept
returns the string representation of the host
auto host(string host_s) -> result<void> noexcept
sets the host
auto port() const -> unsigned short noexcept
gets the port
void port(unsigned short p) noexcept
sets the port
auto to_string() const -> result<string> noexcept
convert address to string

Function documentation

static result<inet_address> ark::net::inet_address::from_address(address addr) noexcept

downcast from an address

error if the address family does not match

result<string> ark::net::inet_address::host() const noexcept

returns the string representation of the host

error if the host is invalid

result<void> ark::net::inet_address::host(string host_s) noexcept

sets the host

Parameters
host_s in ipv4 string representation, like '127.0.0.1'

error if the given string is invalid

result<string> ark::net::inet_address::to_string() const noexcept

convert address to string

format is 'host:port', like '127.0.0.1:8080'

error if the address is invalid