A proxy to a socket address.
More...
#include <rw/network/RWSockAddr.h>
RWSockAddr is a proxy to a socket address of a type that is not known until runtime. The RWSockAddr keeps a handle to a reference-counted RWSockAddrBase object, which is the real address. The RWSockAddr passes requests on to this object.
◆ RWSockAddr() [1/5]
RWSockAddr::RWSockAddr |
( |
| ) |
|
Creates an invalid address. The address must be set to something useful before trying to use it. Common methods to set the address include shifting the address in from an std::istream or using the assignment operator.
◆ RWSockAddr() [2/5]
Creates an address object from the C API representation. This constructor uses the rwSockAddrFactory to look up a specific construction routine to construct the address. An RWNetNoNumberFactoryRegisteredError exception is thrown if the address is not a recognized type.
◆ RWSockAddr() [3/5]
RWSockAddr::RWSockAddr |
( |
sockaddr * | addr, |
|
|
RWSockLenType | len, |
|
|
int | type ) |
Creates an address object from the C API representation. This constructor uses the rwSockAddrFactory to look up a specific construction routine to construct the address. An RWNetNoNumberFactoryRegisteredError exception is thrown if the address is not a recognized type.
◆ RWSockAddr() [4/5]
RWSockAddr::RWSockAddr |
( |
const RWCString & | str | ) |
|
Constructs an address from the address specification in the string. The first token in the string indicates the type of address. The remainder indicates the specific address. Examples of the format are "inet ftp.roguewave.com ftp
" and "inet www.roguewave.com 80
". The RWSockAddrFactory is used to actually construct the address. An RWNetNoNameFactoryRegisteredError exception is thrown if the address is not a recognized type. The RWCString should contain 7-bit US-ASCII data.
◆ RWSockAddr() [5/5]
Constructs an RWSockAddr that represents addr. addr must be an object allocated on the heap. It is deleted when no RWSockAddr objects refer to it. This constructor is available for general use, but it is most often used by the RWSockAddrFactory.
◆ addressType()
virtual RWSockType RWSockAddr::addressType |
( |
| ) |
const |
|
virtual |
◆ asSockaddr()
virtual sockaddr * RWSockAddr::asSockaddr |
( |
| ) |
const |
|
virtual |
Returns a pointer to an internal representation of the address that was cast to a sockaddr
structure, as defined by the sockets and TLI APIs (TLI is the Unix System V network communication interface). The pointer is to an internal data structure, so it becomes invalid if this object is changed in any way or goes out of scope. If the address has no representation as a sockaddr
, a null pointer is returned.
Implements RWSockAddrBase.
◆ id()
virtual RWCString RWSockAddr::id |
( |
unsigned | level = 0 | ) |
const |
|
virtual |
Returns a string describing self. The verbosity of the output is controlled by level where level=0
is the most basic output, and level=9
is the most verbose. The RWCString should contain 7-bit US-ASCII data.
Implements RWSockAddrBase.
◆ isValid()
bool RWSockAddr::isValid |
( |
| ) |
const |
|
inline |
Returns true
if this address is a proxy to a real address. A proxy to an invalid address is created using the default constructor.
◆ myAddress()
Used by derived classes to implement narrowing conversions from an RWSockAddr or an RWSockAddrBase to a derived address type. It returns this
, unless this
address is a proxy, in which case it returns the pointer to the base class of the object being proxied.
Reimplemented from RWSockAddrBase.
◆ prepare()
virtual void RWSockAddr::prepare |
( |
| ) |
const |
|
virtual |
Forwards the prepare() request onto the real address object. The address object sets up all internal data so that subsequent calls to interfaces on this address do not block.
Reimplemented from RWSockAddrBase.
◆ sockaddrSize()
virtual size_t RWSockAddr::sockaddrSize |
( |
| ) |
const |
|
virtual |
Returns the size of an internal representation of the socket address defined by the sockets.
Implements RWSockAddrBase.
◆ operator>>()
std::istream & operator>> |
( |
std::istream & | , |
|
|
RWSockAddr & | ) |
|
related |
Reads an address from an input stream or writes it onto an output stream.