Oracle Coherence for C++ API
Release 3.6.0.0
E15728-01

- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# InetAddress Class Reference

`#include <coherence/net/InetAddress.hpp>`

Inherits Object.

List of all members.

## Detailed Description

InetAddress represents an IP address.

Author:
  mf 2008.03.17

## Public Types
typedef spec::Handle | Handle
| InetAddress Handle definition.
typedef spec::View | View
| InetAddress View definition.
typedef spec::Holder | Holder
| InetAddress Holder definition.
## Public Member Functions
virtual String::View | getHostName () const
| Return the hostname associated with this address.
virtual String::View | getHostAddress () const
| Return the address in textual form.
virtual Array < octet_t >::View | getAddress () const
| Return the raw IP address, in network byte order, with the highest order byte stored at index zero.
virtual void | toStream (std::ostream &out) const
| Output a human-readable description of this Object to the given stream. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.
     Object::View vKey   = ...
     Object::View vValue = ...
     std::cout << vKey << " = " << vValue << std::endl;

     String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);
  Parameters:
  | out | the stream used to output the description
virtual bool | equals (Object::View that) const
virtual size32_t | hashCode () const
| Return a hash code value for the Object. This method is supported for the benefit of hash-based containers. The general contract of `hashCode` is: Whenever it is invoked on the same Object more than once during an execution of an application, the `hashCode` method must consistently return the same value, provided no information used in `equals` comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application. If two Objects are equal according to the `equals` method, then calling the `hashCode` method on each of the two Objects must produce the same value. It is not required that if two Objects are unequal according to the `equals` method, then calling the `hashCode` method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers. The default implementation is identity based. Returns: a hash code value for this Object
## Static Public Member Functions
static InetAddress::View | getLocalHost ()
| Return the InetAddress for the local machine.
static InetAddress::View | getByName (String::View vHost)
| Return the InetAddress for the specified machine name.
## Protected Member Functions
| InetAddress (String::View vsHost, Array< octet_t >::View vaIP)
| Manually construct an InetAddress from a network byte ordered array.
| InetAddress (const InetAddress &)
| Copy Constructor.

## Constructor & Destructor Documentation

InetAddress | ( | String::View | vsHost,
|  | Array< octet_t >::View | vaIP |
| ) |  |  | `[protected]`

Manually construct an InetAddress from a network byte ordered array.

It is recommended that the getByName() method be used in place of manual InetAddress construction.

Parameters:

  | vsName | the name of the host
  | vaIP | the array representation of the host's IP address.

## Member Function Documentation

static InetAddress::View getLocalHost | ( |  | ) | `[static]`

Return the InetAddress for the local machine.

Returns:
  the local InetAddress.

static InetAddress::View getByName | ( | String::View | vHost | ) | `[static]`

Return the InetAddress for the specified machine name.

Parameters:

  | vHost | the name or IP of the host to resolve

Returns:
  the InetAddress for the specified machine name

virtual String::View getHostName | ( |  | ) | const `[virtual]`

Return the hostname associated with this address.

Returns:
  the hostname associated with this address

virtual String::View getHostAddress | ( |  | ) | const `[virtual]`

Return the address in textual form.

Returns:
  the address in textual form

virtual Array<octet_t>::View getAddress | ( |  | ) | const `[virtual]`

Return the raw IP address, in network byte order, with the highest order byte stored at index zero.

Returns:
  the raw IP address

The documentation for this class was generated from the following file:

- coherence/net/InetAddress.hpp

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.