ark::comms::NetworkAddress

Defined in header “ark/comms/network_address.hh”.


A configuration for a network address. This includes an IP address and a port, which can be used for binding or connecting sockets.

Methods

  • NetworkAddress()
    Default constructor.

  • NetworkAddress(const std::string & ip, uint16_t port)
    Convenience constructor. Initializes the IP address and port directly.

  • NetworkAddress(uint32_t address, uint16_t port)
    Convenience constructor. Initializes the IP address and port directly.

  • NetworkAddress(const std::string & ip_port_pair)
    Convenience constructor. Initializes from a IP address/port combination.

  • std::string str()
    Returns a human-readable string of this address.

  • std::optional< uint32_t > address()
    Returns the raw address bits, if any are set.

  • uint16_t port_number()
    Returns the port number of this address.

  • bool empty()
    Returns true if the address is empty, false otherwise. An empty address is one without an address or port.

  • std::string address_str()
    Returns the address as a string (as opposed to str(), which returns both the address and port).

  • bool operator==(const NetworkAddress & other)
    Default comparison.

  • auto operator(const NetworkAddress & rhs)
    Spaceship comparison, for maps.