asio 0.1.5 Main Page | Class Index | Member Index | Tutorial

address Class Reference

The address class implements IP version 4 style addresses. More...

List of all members.

Public Types

typedef tcp default_stream_protocol
 The default stream-based protocol associated with the address type.

typedef udp default_dgram_protocol
 The default datagram-based protocol associated with the address type.

typedef detail::socket_addr_type native_address_type
 The native types of the socket address. These types are dependent on the underlying implementation of the socket layer.

typedef boost::uint_t<
16 >::least 
port_type
 Underlying types for internet addresses.


Public Member Functions

 address ()
 Default constructor.

 address (port_type port_num)
 Construct an address using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY). This constructor would typically be used for accepting new connections.

 address (port_type port_num, addr_type host_addr)
 Construct an address using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote address.

 address (port_type port_num, const std::string &host)
 Construct an address using a port number and an IP address in dotted decimal form or a host name. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote address.

 address (const address &other)
 Copy constructor.

addressoperator= (const address &other)
 Assign from another address.

int family () const
 The address family.

native_address_typenative_address ()
 Get the underlying address in the native type.

const native_address_typenative_address () const
 Get the underlying address in the native type.

native_size_type native_size () const
 Get the underlying size of the address in the native type.

void native_size (native_size_type size)
 Set the underlying size of the address in the native type.

port_type port () const
 Get the port associated with the address. The port number is always in the host's byte order.

void port (port_type port_num)
 Set the port associated with the address. The port number is always in the host's byte order.

addr_type host_addr () const
 Get the host associated with the address in the numeric form.

void host_addr (addr_type host)
 Set the host associated with the address.

std::string host_addr_str () const
 Get the host's address in dotted decimal format.

void host_addr_str (const std::string &host)
 Set the host's address using dotted decimal format.

std::string host_name () const
 Get the host name.

void host_name (const std::string &host)
 Set the host name.


Detailed Description

The address class implements IP version 4 style addresses.


Member Typedef Documentation

typedef tcp default_stream_protocol
 

The default stream-based protocol associated with the address type.

typedef udp default_dgram_protocol
 

The default datagram-based protocol associated with the address type.

typedef detail::socket_addr_type native_address_type
 

The native types of the socket address. These types are dependent on the underlying implementation of the socket layer.

typedef boost::uint_t<16>::least port_type
 

Underlying types for internet addresses.


Constructor & Destructor Documentation

address  ) 
 

Default constructor.

address port_type  port_num  ) 
 

Construct an address using a port number, specified in the host's byte order. The IP address will be the any address (i.e. INADDR_ANY). This constructor would typically be used for accepting new connections.

address port_type  port_num,
addr_type  host_addr
 

Construct an address using a port number and an IP address. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote address.

address port_type  port_num,
const std::string &  host
 

Construct an address using a port number and an IP address in dotted decimal form or a host name. This constructor may be used for accepting connections on a specific interface or for making a connection to a remote address.

address const address other  ) 
 

Copy constructor.


Member Function Documentation

address& operator= const address other  ) 
 

Assign from another address.

int family  )  const
 

The address family.

native_address_type* native_address  ) 
 

Get the underlying address in the native type.

const native_address_type* native_address  )  const
 

Get the underlying address in the native type.

native_size_type native_size  )  const
 

Get the underlying size of the address in the native type.

void native_size native_size_type  size  ) 
 

Set the underlying size of the address in the native type.

port_type port  )  const
 

Get the port associated with the address. The port number is always in the host's byte order.

void port port_type  port_num  ) 
 

Set the port associated with the address. The port number is always in the host's byte order.

addr_type host_addr  )  const
 

Get the host associated with the address in the numeric form.

void host_addr addr_type  host  ) 
 

Set the host associated with the address.

std::string host_addr_str  )  const
 

Get the host's address in dotted decimal format.

void host_addr_str const std::string &  host  ) 
 

Set the host's address using dotted decimal format.

std::string host_name  )  const
 

Get the host name.

void host_name const std::string &  host  ) 
 

Set the host name.