SourcePro® C++ 2016 |
SourcePro® C++ API Reference Guide |
Product Documentation: SourcePro C++ Documentation Home |
A proxy to a socket address. More...
#include <rw/network/RWSockAddr.h>
Public Member Functions | |
RWSockAddr () | |
RWSockAddr (sockaddr *addr, RWSockLenType len) | |
RWSockAddr (sockaddr *addr, RWSockLenType len, int type) | |
RWSockAddr (const RWCString &str) | |
RWSockAddr (RWSockAddrBase *addr) | |
virtual RWSockType | addressType () const |
virtual sockaddr * | asSockaddr () const |
virtual RWCString | id (unsigned level=0) const |
bool | isValid () const |
virtual void | prepare () const |
virtual size_t | sockaddrSize () const |
Public Member Functions inherited from RWSockAddrBase | |
virtual | ~RWSockAddrBase () |
int | getDomain () const |
int | getFamily () const |
RWCString | getFamilyName () const |
int | getProtocol () const |
int | getType () const |
virtual | operator RWCString () const |
Private Member Functions | |
virtual const RWSockAddrBase * | myAddress () const |
Related Functions | |
(Note that these are not member functions.) | |
std::istream & | operator>> (std::istream &, RWSockAddr &) |
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::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::RWSockAddr | ( | sockaddr * | addr, |
RWSockLenType | len | ||
) |
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::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::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::RWSockAddr | ( | RWSockAddrBase * | addr | ) |
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.
|
virtual |
Returns the type of address.
Implements RWSockAddrBase.
|
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.
|
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.
|
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.
|
privatevirtual |
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.
|
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.
|
virtual |
Returns the size of an internal representation of the socket address defined by the sockets.
Implements RWSockAddrBase.
|
related |
Reads an address from an input stream or writes it onto an output stream.
Copyright © 2016 Rogue Wave Software, Inc. All Rights Reserved. |