rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWInetHost Class Reference
[Essential Networking Module]

Encapsulates an Internet host IP address and its names. More...

#include <rw/network/RWInetHost.h>

List of all members.

Public Types

enum  NameLookup { numeric }

Public Member Functions

 RWInetHost ()
 RWInetHost (unsigned long IPAddress)
 RWInetHost (const RWCString &hostname)
 RWInetHost (const char *)
void prepare () const
void prepare (NameLookup lookup) const
RWCString getName () const
unsigned long getAddress () const
RWTValVector< RWCStringgetAliases () const
RWTValVector< unsigned long > getAddresses () const
RWCString id (unsigned level=0) const
bool operator== (const RWInetHost &rhs) const
bool operator!= (const RWInetHost &rhs) const

Static Public Member Functions

static RWInetHost me ()
static RWCString addressAsString (unsigned long IPAddress)

Related Functions

(Note that these are not member functions.)



std::ostream & operator<< (std::ostream &strm, const RWInetHost &host)

Detailed Description

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.

Member Enumeration Documentation

Attributes to change name lookup behavior.

Enumerator:
numeric 

If the host address is already known, a lookup will not be used to discover the host name. The dotted decimal form of the host address will be used as the host name.


Constructor & Destructor Documentation

RWInetHost::RWInetHost (  ) 

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.

RWInetHost::RWInetHost ( unsigned long  IPAddress  ) 

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.

RWInetHost::RWInetHost ( const RWCString hostname  ) 

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.

RWInetHost::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.


Member Function Documentation

static RWCString RWInetHost::addressAsString ( unsigned long  IPAddress  )  [static]

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.

unsigned long RWInetHost::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> RWInetHost::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> RWInetHost::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.

Note:
Aliases are returned only if the RWInetHost was constructed with a hostname (as opposed to an IP Address). If the class was constructed with an IP address, no aliases are fetched.
RWCString RWInetHost::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 RWInetHost::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.

static RWInetHost RWInetHost::me (  )  [static]

Returns the host object for the host on which this program is currently running.

bool RWInetHost::operator!= ( const RWInetHost rhs  )  const

Returns true if the two host objects are not equal.

bool RWInetHost::operator== ( const RWInetHost rhs  )  const

Returns true if the two host objects are equal.

void RWInetHost::prepare ( NameLookup  lookup  )  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 RWInetHost::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().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  strm,
const RWInetHost host 
) [related]

Outputs a representation of host on strm. The representation is generated using the member function host.id() with level=0.

Note:
This class does not have an extraction (>>) operator.
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.