Constructing a Host
A host is identified by either a symbolic name, like net.roguewave.com, or by an IPv6 hex address, like fe80::2b0:d0ff:fe92:873c. A particular host can have more than one symbolic name. A host address usually has only one IPv6 address, although it is possible for a host to have more than one address.
You can construct a host object by specifying either the IP address or host name as a string, as shown in the following examples.
RWInet6Host host1("net.roguewave.com");
RWInet6Host host2("fe80::2b0:d0ff:fe92:873c");
Once a host object is constructed, you can use the member functions of
RWInet6Host to determine characteristics of the host.
Example 11 prints information about a host.
Example 11 – Printing information about a host.
#include <rw/rstream.h>
#include <rw/network/RWInet6Host.h>
int main()
{
RWWinSockInfo winsock;
RWInet6Host host = RWInet6Host::me(); // 1
cout << host.getName() << endl; // 2
cout << RWInet6Host::addressAsString(host.getAddress()) // 3
<< endl;
return 0;
}