SocketAddress Class Reference

A socket endpoint network address. More...

#include <SocketAddress.h++>

List of all members.

Public Member Functions

 SocketAddress () throw ()
 Construct a new, null SocketAddress.
 SocketAddress (const InetAddress &address, uint16_t port)
 Construct a new SocketAddress for a given IP address and port number.
 SocketAddress (const struct sockaddr &other) throw ()
 Construct a new SocketAddress for a given sockaddr structure.
 SocketAddress (const struct sockaddr_in &other) throw ()
 Construct a new SocketAddress for a given sockaddr_in structure.
 SocketAddress (const SocketAddress &other) throw ()
 Copy constructor.
 ~SocketAddress () throw ()
 Destructor.
SocketAddressoperator= (const struct sockaddr &other) throw ()
 Assignment operator.
SocketAddressoperator= (const struct sockaddr_in &other) throw ()
 Assignment operator.
SocketAddressoperator= (const SocketAddress &other) throw ()
 Assignment operator.
InetAddress getAddress () const throw ()
 Get the IP address for this address.
void setAddress (const InetAddress &address) throw ()
 Set the IP address for this address.
void setHost (const String &host) throw (HostNotFoundException)
 Set the hostname for this address.
uint16_t getPort () const throw ()
 Get the port number for this address.
void setPort (uint16_t port) throw ()
 Set the port number for this address.
void setSocketAddress (const struct sockaddr &addr) throw ()
 Set the address from a sockaddr structure.
sockaddr getSocketAddress () const throw ()
 Get the address as a sockaddr structure.
void reset () throw ()
 Reset the address to a null address.
 operator sockaddr * () throw ()
 Cast operator.
 operator sockaddr_in * () throw ()
 Cast operator.
String toString () const
 Get a String representation for this address.
bool operator== (const SocketAddress &other) const throw ()
 Equality operator.
bool operator!= (const SocketAddress &other) const throw ()
 Inequality operator.


Detailed Description

A socket endpoint network address.

The address consists of an IP address and a port number.

Author:
Mark Lindner

Constructor & Destructor Documentation

SocketAddress (  )  throw ()

Construct a new, null SocketAddress.

SocketAddress ( const InetAddress address,
uint16_t  port 
)

Construct a new SocketAddress for a given IP address and port number.

Parameters:
address The IP address.
port The port number.

SocketAddress ( const struct sockaddr &  other  )  throw () [explicit]

Construct a new SocketAddress for a given sockaddr structure.

SocketAddress ( const struct sockaddr_in &  other  )  throw () [explicit]

Construct a new SocketAddress for a given sockaddr_in structure.

SocketAddress ( const SocketAddress other  )  throw ()

Copy constructor.

~SocketAddress (  )  throw ()

Destructor.


Member Function Documentation

InetAddress getAddress (  )  const throw ()

Get the IP address for this address.

uint16_t getPort (  )  const throw () [inline]

Get the port number for this address.

sockaddr getSocketAddress (  )  const throw () [inline]

Get the address as a sockaddr structure.

operator sockaddr * (  )  throw () [inline]

Cast operator.

operator sockaddr_in * (  )  throw () [inline]

Cast operator.

bool operator!= ( const SocketAddress other  )  const throw () [inline]

Inequality operator.

SocketAddress & operator= ( const SocketAddress other  )  throw ()

Assignment operator.

SocketAddress & operator= ( const struct sockaddr_in &  other  )  throw ()

Assignment operator.

SocketAddress & operator= ( const struct sockaddr &  other  )  throw ()

Assignment operator.

bool operator== ( const SocketAddress other  )  const throw ()

Equality operator.

void reset (  )  throw ()

Reset the address to a null address.

void setAddress ( const InetAddress address  )  throw ()

Set the IP address for this address.

void setHost ( const String host  )  throw (HostNotFoundException)

Set the hostname for this address.

Parameters:
host The host, as a dot-separated IP address or DNS name.
Exceptions:
HostNotFoundException If the hostname could not be resolved.

void setPort ( uint16_t  port  )  throw () [inline]

Set the port number for this address.

void setSocketAddress ( const struct sockaddr &  addr  )  throw () [inline]

Set the address from a sockaddr structure.

String toString (  )  const

Get a String representation for this address.


Member Data Documentation

struct sockaddr_in _insaddr [read]

struct sockaddr _saddr [read]


The documentation for this class was generated from the following files:

Generated on Sat Apr 17 23:03:10 2010 for libcommonc++ by  doxygen 1.5.9