Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

InetAddress Class Reference

Inherits Address.

List of all members.


Detailed Description

An IP Address and port.

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


Member Typedef Documentation

typedef unsigned int InetAddress::port
 

The type used to represent a port.


Constructor & Destructor Documentation

InetAddress::InetAddress  
 

Constructs an empty Address.

InetAddress::InetAddress port    pt
 

Constructs an Address from a port (using INADDR_ANY as the host).

InetAddress::InetAddress string    ip,
port    pt = 0
 

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.

InetAddress::InetAddress string    ip,
string    pt
 

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.

InetAddress::InetAddress const Address   other [explicit]
 

Coerces an Address to an IP Address, yielding an empty Address if the Address is not an IP Address.


Member Function Documentation

string InetAddress::as_string   const
 

Returns a human-readable version of this Address.

Reimplemented from Address.

string InetAddress::get_host   const
 

Returns the host as a dotted-quad string.

string InetAddress::get_hostname   const
 

Returns the hostname, as obtained by gethostbyaddr.

This method may block.

port InetAddress::get_port   const
 

Returns the port (or zero if none).

const sockaddr_in* InetAddress::inetaddr   const [protected]
 

string InetAddress::local_hostname   [static]
 

InetAddress::NMSTL_SIMPLY_SERIALIZABLE InetAddress   ,
<<    addr
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:11 2002 for NMSTL