libcommonc++
0.7
|
A socket endpoint network address. More...
#include <SocketAddress.h++>
Public Member Functions | |
SocketAddress () | |
Construct a new, null SocketAddress. More... | |
SocketAddress (const InetAddress &address, uint16_t port) | |
Construct a new SocketAddress for a given IP address and port number. More... | |
SocketAddress (const struct sockaddr &other) | |
Construct a new SocketAddress for a given sockaddr structure. More... | |
SocketAddress (const struct sockaddr_in &other) | |
Construct a new SocketAddress for a given sockaddr_in structure. More... | |
SocketAddress (const SocketAddress &other) | |
Copy constructor. More... | |
~SocketAddress () | |
Destructor. More... | |
SocketAddress & | operator= (const struct sockaddr &other) |
Assignment operator. More... | |
SocketAddress & | operator= (const struct sockaddr_in &other) |
Assignment operator. More... | |
SocketAddress & | operator= (const SocketAddress &other) |
Assignment operator. More... | |
InetAddress | getAddress () const |
Get the IP address for this address. More... | |
void | setAddress (const InetAddress &address) |
Set the IP address for this address. More... | |
void | setHost (const String &host) |
Set the hostname for this address. More... | |
uint16_t | getPort () const |
Get the port number for this address. More... | |
void | setPort (uint16_t port) |
Set the port number for this address. More... | |
void | setSocketAddress (const struct sockaddr &addr) |
Set the address from a sockaddr structure. More... | |
sockaddr | getSocketAddress () const |
Get the address as a sockaddr structure. More... | |
void | reset () |
Reset the address to a null address. More... | |
operator sockaddr * () | |
Cast operator. More... | |
operator sockaddr_in * () | |
Cast operator. More... | |
String | toString () const |
Get a String representation for this address. More... | |
bool | operator== (const SocketAddress &other) const |
Equality operator. More... | |
bool | operator!= (const SocketAddress &other) const |
Inequality operator. More... | |
A socket endpoint network address.
The address consists of an IP address and a port number.
SocketAddress | ( | ) |
Construct a new, null SocketAddress.
SocketAddress | ( | const InetAddress & | address, |
uint16_t | port | ||
) |
Construct a new SocketAddress for a given IP address and port number.
address | The IP address. |
port | The port number. |
|
explicit |
Construct a new SocketAddress for a given sockaddr structure.
|
explicit |
Construct a new SocketAddress for a given sockaddr_in structure.
SocketAddress | ( | const SocketAddress & | other | ) |
Copy constructor.
~SocketAddress | ( | ) |
Destructor.
InetAddress getAddress | ( | ) | const |
Get the IP address for this address.
|
inline |
Get the port number for this address.
|
inline |
Get the address as a sockaddr structure.
|
inline |
Cast operator.
|
inline |
Cast operator.
|
inline |
Inequality operator.
SocketAddress & operator= | ( | const struct sockaddr & | other | ) |
Assignment operator.
SocketAddress & operator= | ( | const struct sockaddr_in & | other | ) |
Assignment operator.
SocketAddress & operator= | ( | const SocketAddress & | other | ) |
Assignment operator.
bool operator== | ( | const SocketAddress & | other | ) | const |
Equality operator.
void reset | ( | ) |
Reset the address to a null address.
void setAddress | ( | const InetAddress & | address | ) |
Set the IP address for this address.
void setHost | ( | const String & | host | ) |
Set the hostname for this address.
host | The host, as a dot-separated IP address or DNS name. |
HostNotFoundException | If the hostname could not be resolved. |
|
inline |
Set the port number for this address.
|
inline |
Set the address from a sockaddr structure.
struct sockaddr_in _insaddr |
struct sockaddr _saddr |