RWInetAddrRWInetHost
Networking Tools: Network Communication Classes (net library)
address() addressAsString() addresses() |
aliases() id() me() |
name() operator<<() operator=() |
prepare() |
#include <rw/toolpro/inetaddr.h> RWInetHost host("objects.roguewave.com")
net, tls (and possibly std)
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 will only include alias names 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.
RWInetHost(const RWInetHost& x);
Creates a copy of x.
unsigned long address() 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> addresses() 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> aliases() 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.
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.
RWCString name() const;
Returns the official name for this host entry. This call may block if prepare() has not been called.
void prepare() const;
Ensures that no future operations block. The prepare() function calls the host database routines to learn all that can be learned about this host. It is not necessary to explicitly call prepare() since it is called by other member functions if needed. No exceptions are thrown by prepare().
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.
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.
Note: This class does not have an extraction (>>) operator.
RWInetHost& operator=(const RWInetHost& 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.