Module: Essential Networking Module Package: Networking
Does not inherit
addressAsString() getAddress() getAddresses() |
getAliases() getName() id() |
me() operator operator==() |
prepare() RWInetHost() |
#include <rw/network/RWInetHost.h>
Encapsulates an Internet host IP address and its names. You can construct an RWInetHost from either an IP address or a symbolic name.
NOTE -- Typically, Winsock implementations do not return a default alias. As a result, an RWInetHost object on a Windows platform includes alias names only if they have been explicitly defined.
RWInetHost(); RWInetHost(unsigned long IPAddress); RWInetHost(const RWCString& hostname); RWInetHost(const char *);
An Internet host can be specified as an actual address or through a string. The string can be either the symbolic name of the host or an IP address in dotted decimal notation. If an IP address is passed in as a long, it must be in network byte order. The default constructor creates a special host that represents an unspecified IP address on the current machine. This is useful when constructing servers. The RWCString should contain 7-bit US-ASCII data.
enum
NameLookup {numeric};
bool operator==(const RWInetHost& rhs) const;
Returns true if the two host objects are equal.
bool operator!=(const RWInetHost& rhs) const;
Returns true if the two host objects are not equal.
unsigned long getAddress() const;
Returns the primary IP address for this host entry in network byte order. If you want to print out an IP address, use the addressAsString() static member function.
RWTValVector<unsigned long> getAddresses() const;
Returns a list of addresses for this host entry. Addresses are returned in network byte order. If you want to print out an IP address, use the addressAsString() static member function. The primary address is the first entry in the addresses() array. This call may block if prepare() has not been called.
RWTValVector<RWCString> getAliases() const;
Returns the list of aliases for this host entry. The official name is not included in the list of aliases. This call may block if prepare() has not been called. The RWCString should contain 7-bit US-ASCII data.
RWCString getName() const;
Returns the official name for this host entry. This call may block if prepare() has not been called. The RWCString should contain 7-bit US-ASCII data.
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. The RWCString should contain 7-bit US-ASCII data.
void prepare() const;
Ensures that no future operations block. The prepare() function calls the host database routines to gather information about this host. It is not necessary to explicitly call prepare() because it is called by other member functions if needed. No exceptions are thrown by prepare().
void prepare(NameLookup lookup) const;
Ensures that no future operations block. If lookup is RWInetHost::numeric, a lookup will not occur in order to discover the name of the host, and the dotted decimal form of the address will be used for the name.
static RWCString addressAsString(unsigned long IPAddress);
Takes an address in network byte order and returns the dotted decimal string representation of the address. To go from a dotted decimal string to an address, build an RWInetHost object from the dotted decimal string. The RWCString should contain 7-bit US-ASCII data.
static RWInetHost me();
Returns the host object for the host on which this program is currently running.
ostream& operator<<(ostream& strm, const RWInetHost& x);
Outputs a representation of x on strm. The representation is generated using the member function x.id() with level=0.
© 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.