host |
A host is a computer that is connected to zero or more networks. Each host on the Internet has a name, a set of aliases, and a set of IP addresses.
You can construct an os_host
from either a name or an IP address. For convenience, the static function my_host()
returns your local host. The following example lists the contents of the host
database and demonstrates both modes of construction. To compile and run this
example on your computer, modify it to use valid host names and IP addresses.
#include <iostream>
#include <ospace/network.h>
void
main()
{
os_network_toolkit init_network;
cout << "my host = " << os_host::my_host() << endl;
os_host host1( "www.wku.edu" );
cout << "host1 = " << host1 << endl;
os_host host2( os_ip_address( "www.purdue.edu" ) );
cout << "host2 = " << host2 << endl;
}
my host = os_host( bigred, os_ip_address( 127.0.0.1 ) )
host1 = os_host( beta.wku.edu, os_ip_address( 161.6.5.7 ) )
host2 = os_host( mortar.cc.purdue.edu, os_ip_address( 128.210.11.200 ))
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.