NetworkAddressΒΆ
Inherited: None
DescriptionΒΆ
The NetworkAddress class provides a way to represent an IP address and its associated port. It supports initialization via raw values (IP address in integer format or string format), and provides methods for comparison, conversion, and retrieval of IP address and port information.
Public MethodsΒΆ
NetworkAddress (uint32_t address, uint16_t port) |
|
NetworkAddress (const TString & address, uint16_t port) |
|
uint16_t |
port () const |
uint32_t |
toIPv4Adress () const |
bool |
operator!= (const NetworkAddress & right) const |
bool |
operator< (const NetworkAddress & right) const |
bool |
operator== (const NetworkAddress & right) const |
Static MethodsΒΆ
None
Methods DescriptionΒΆ
NetworkAddress::NetworkAddress ()
Default constructor that initializes the address to 0 and port to 0.
NetworkAddress::NetworkAddress (uint32_t address, uint16_t port)
Constructor that initializes the NetworkAddress with the provided IP address and port.
NetworkAddress::NetworkAddress (TString & address, uint16_t port)
Constructor that initializes the NetworkAddress using a string representation of the IP address (either hostname or numeric IP address) and the specified port.
uint16_t NetworkAddress::port () const
Returns the port number stored in the NetworkAddress object.
uint32_t NetworkAddress::toIPv4Adress () const
Returns the IP address stored in the NetworkAddress object as a uint32_t value.
bool NetworkAddress::operator!= (NetworkAddress & right) const
Compares a this NetworkAddress with NetworkAddress right object. Returns false if addresses are equal; otherwise returns true.
bool NetworkAddress::operator< (NetworkAddress & right) const
Compares this NetworkAddress with right object to determine if the current object is βless thanβ the provided object based on the IP address alone. Returns true if the address is less than right; otherwise returns false.
bool NetworkAddress::operator== (NetworkAddress & right) const
Compares a this NetworkAddress with NetworkAddress right object. Returns true if addresses are equal; otherwise returns false.