Module: Essential Networking Module Package: Networking
RWInet6AddrRWSockAddrBase
addressType() as() asSockaddr() getHost() |
getPort() getScope() id() is() |
operator operator==() prepare() RWInet6Addr() |
sockaddrSize() |
#include <rw/network/RWInet6Addr.h>
Constructs a complete IPv6 address that includes type information, host, port, and scope.
RWInet6Addr addr(8001, "0::1");
RWInet6Addr(); RWInet6Addr(const RWInetPort& port); RWInet6Addr(const RWInetPort& port, const RWInet6Host& host, unsigned scope = 0, short type = SOCK_STREAM, short protocol = 0); RWInet6Addr(const sockaddr_in6& addr, short type = SOCK_STREAM, short protocol = 0);
Constructs an address for an IPv6 Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInet6Addr(const RWCString& s);
Constructs an address from the value for s, where s has the form type:host%scope:port. type, host, and scope are optional. If type is supplied, it must be stream for a stream socket address, or dgram for a datagram socket. host should be wrapped in square brackets ('[' and ']') if the string should contain an IPv6 hex address. scope is only required if its value is nonzero.
bool operator==(const RWInet6Addr& rhs) const; bool operator!=(const RWInet6Addr& rhs) const;
Comparison operators.
virtual RWSockType addressType() const;
Returns the address type.
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 V network communication interface.) The pointer is to an internal data structure, so it becomes invalid if self is changed in any way or goes out of scope. If the address has no representation as a sockaddr, a null pointer is returned.
RWInet6Host getHost() const;
Returns the host portion of the address.
RWInetPort getPort() const;
Returns the port portion of the address.
unsigned getScope() const;
Returns the scope portion of the address.
virtual RWCString id(unsigned level=0) const;
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.
virtual void prepare() const;
Ensures that future calls do not block on this address. If necessary, this function looks up the IP address and port number from the host name and service name. It is not necessary to call prepare(), but if you don't, future calls may block. No exceptions are thrown from prepare().
virtual size_t sockaddrSize() const;
Returns the size of an internal representation of the socket address defined by the sockets.
static bool is(const RWSockAddrBase& aalmddr);
Returns true if addr is an RWInet6Addr.
static RWInet6Addr as(const RWSockAddrBase& addr);
Casts addr to RWInet6Addr, if appropriate. Otherwise, it throws an RWSockWrongAddressType exception.
istream& operator>>(istream& strm, RWInet6Addr& addr);
Reads a representation of addr from strm. The representation should be of the form produced by id() with level=2.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.