Network address type. More...
|CNetworkAddress (int port)|
|CNetworkAddress (const CString &hostname, int port)|
|CNetworkAddress (const CNetworkAddress &)|
|CNetworkAddress &||operator= (const CNetworkAddress &)|
|Resolve address. |
|bool||operator== (const CNetworkAddress &address) const|
|Check address equality. |
|bool||operator!= (const CNetworkAddress &address) const|
|Check address inequality. |
|bool||isValid () const|
|Check address validity. |
|const CArchNetAddress &||getAddress () const|
|Get address. |
|int||getPort () const|
|Get port. |
|CString||getHostname () const|
|Get hostname. |
Network address type.
This class represents a network address.
|CNetworkAddress::CNetworkAddress||(||const CString &||hostname,|
Construct the network address for the given
hostname can be parsed as a numerical address then that's how it's used, otherwise it's used as a host name. If
hostname ends in ":[0-9]+" then that suffix is extracted and used as the port, overridding the port parameter. The resulting port must be a valid port number (zero is not a valid port number) otherwise
XSocketAddress is thrown with an error of
XSocketAddress::kBadPort. The hostname is not resolved by the c'tor; use
resolve to do that.
|const CArchNetAddress & CNetworkAddress::getAddress||(||)||const|
|bool CNetworkAddress::operator!=||(||const CNetworkAddress &||address||)||const|
|bool CNetworkAddress::operator==||(||const CNetworkAddress &||address||)||const|
Resolves the hostname to an address. This can be done any number of times and is done automatically by the c'tor taking a hostname. Throws XSocketAddress if resolution is unsuccessful, after which
isValid returns false until the next call to this method.
Referenced by CClient::connect().