Currently only IPv4 addresses are supported, but this class may encapsulate IPv6 addresses as well in the future.
Public Types | |
typedef unsigned int | port |
The type used to represent a port. | |
Public Methods | |
InetAddress () | |
Constructs an empty Address. | |
InetAddress (port pt) | |
Constructs an Address from a port (using INADDR_ANY as the host). | |
InetAddress (string ip, port pt=0) | |
Constructs an Address from a host name and port. | |
InetAddress (string ip, string pt) | |
Constructs an Address from a host name and port string. | |
InetAddress (const Address &other) | |
Coerces an Address to an IP Address, yielding an empty Address if the Address is not an IP Address. | |
string | get_host () const |
Returns the host as a dotted-quad string. | |
string | get_hostname () const |
Returns the hostname, as obtained by gethostbyaddr. | |
port | get_port () const |
Returns the port (or zero if none). | |
string | as_string () const |
Returns a human-readable version of this Address. | |
NMSTL_SIMPLY_SERIALIZABLE (InetAddress,<< addr) | |
Static Public Methods | |
string | local_hostname () |
Protected Methods | |
const sockaddr_in * | inetaddr () const |
|
The type used to represent a port.
|
|
Constructs an empty Address.
|
|
Constructs an Address from a port (using INADDR_ANY as the host).
|
|
Constructs an Address from a host name and port. If the host name is not a dotted quad, this constructor will call gethostbyname to look up the Address and thus may block. |
|
Constructs an Address from a host name and port string. If the host name is not a dotted quad, this constructor will call gethostbyname to look up the Address and thus may block. |
|
Coerces an Address to an IP Address, yielding an empty Address if the Address is not an IP Address.
|
|
Returns a human-readable version of this Address.
Reimplemented from Address. |
|
Returns the host as a dotted-quad string.
|
|
Returns the hostname, as obtained by gethostbyaddr. This method may block. |
|
Returns the port (or zero if none).
|
|
|
|
|
|
|