RWSockAddrRWSockAddrBase
Networking Tools: Network Communication Classes (net library)
addressType() asSockaddr() id() |
operator>>() operator<<() operator=() |
prepare() sockaddrSize() valid() |
#include <rw/toolpro/sockaddr.h>
net, tls (and possibly std)
An 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();
Creates an invalid address. The address must be set to something useful before trying to use it. Common methods to set the address are shifting the address in from an istream, or using the assignment operator.
RWSockAddr(sockaddr *addr, int len); RWSockAddr(sockaddr *addr, int len, int type);
Creates an address object from the C API representation. This uses the rwSockAddrFactory to look up a specific construction routine to construct the address. An exception is thrown if the address is not a recognized type.
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.
RWSockAddr(RWSockAddrBase* addr);
Constructs an RWSockAddr that represents the address passed in. addr must be an object allocated on the heap. It is deleted when no more RWSockAddr objects refer to it. This constructor is available for general use, but it is most often used by the RWSockAddrFactory.
RWSockAddr(const RWSockAddr& x);
Creates a shallow copy of x.
virtual RWSockType addressType() const;
Returns the type of address.
virtual sockaddr* asSockaddr() const;
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 U 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.
RWCString id(unsigned level=0);
Returns a string describing self. The verbosity of the output is controlled by level with level=0 being the most basic output and level=9 the most verbose.
virtual void prepare() const;
Forwards the prepare() request onto the real address object, which sets up all internal data so that subsequent calls to interfaces on this address do not block.
virtual size_t sockaddrSize() const;
Returns the size of an internal representation of the socket address defined by the sockets.
RWBoolean valid() const;
Returns TRUE if this address is a proxy to a real address. A proxy to an invalid address is created using the default constructor.
istream operator>>(istream&, RWSockAddr&); ostream operator<<(ostream&, RWSockAddr&);
Read an address from an input stream or write it onto an output stream.
RWSockAddr& operator=(const RWSockAddr& x);
Makes self a copy of x. The previous contents of self are lost.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.