62 [[nodiscard]]
static std::optional<IpAddress>
resolve(std::string_view address);
77 IpAddress(std::uint8_t byte0, std::uint8_t byte1, std::uint8_t byte2, std::uint8_t byte3);
179 std::uint32_t m_address;
Encapsulate an IPv4 network address.
static std::optional< IpAddress > getLocalAddress()
Get the computer's local address.
static std::optional< IpAddress > getPublicAddress(Time timeout=Time::Zero)
Get the computer's public address.
static const IpAddress Any
Value representing any address (0.0.0.0)
static std::optional< IpAddress > resolve(std::string_view address)
Construct the address from a null-terminated string view.
std::uint32_t toInteger() const
Get an integer representation of the address.
IpAddress(std::uint32_t address)
Construct the address from a 32-bits integer.
static const IpAddress LocalHost
The "localhost" address (for connecting a computer to itself locally)
std::string toString() const
Get a string representation of the address.
static const IpAddress Broadcast
The "broadcast" address (for sending UDP messages to everyone on a local network)
friend bool operator<(IpAddress left, IpAddress right)
Overload of operator< to compare two IP addresses.
IpAddress(std::uint8_t byte0, std::uint8_t byte1, std::uint8_t byte2, std::uint8_t byte3)
Construct the address from 4 bytes.
static const Time Zero
Predefined "zero" time value.
bool operator!=(IpAddress left, IpAddress right)
Overload of operator!= to compare two IP addresses.
bool operator<(IpAddress left, IpAddress right)
Overload of operator< to compare two IP addresses.
bool operator==(IpAddress left, IpAddress right)
Overload of operator== to compare two IP addresses.
bool operator>(IpAddress left, IpAddress right)
Overload of operator> to compare two IP addresses.
bool operator>=(IpAddress left, IpAddress right)
Overload of operator>= to compare two IP addresses.
std::istream & operator>>(std::istream &stream, std::optional< IpAddress > &address)
Overload of operator>> to extract an IP address from an input stream.
bool operator<=(IpAddress left, IpAddress right)
Overload of operator<= to compare two IP addresses.
std::ostream & operator<<(std::ostream &stream, IpAddress address)
Overload of operator<< to print an IP address to an output stream.