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 for connection to more than one network.
Information about hosts is stored in the hosts file (typically /etc/hosts for
UNIX and \windows\hosts for Win32).
An os_host
is an object that represents a single host computer. This object can be
constructed from either the TCP hostname or an IP address.
Declaration
#include <ospace/network/host.h>
class os_host
Interface
Constructor
os_host()
Constructs
a host with an empty name.
Constructor
os_host(
const string& name )
Constructs
a host to represent name .
Throws: os_network_toolkit_error
Constructor
os_host(
const os_ip_address& address )
Constructs
a host to represent the IP address address .
Throws: os_network_toolkit_error
Constructor
os_host(
const hostent& host )
Constructs
a host using the hostent structure host
.
Constructor
os_host(
const os_host& host )
Constructs
a host with the same value as host .
<
bool
operator<( const os_host& host )
const
Returns
true if this host is less than host
.
=
os_host&
operator=( const os_host& host )
Assigns
this host the same value as host .
==
bool
operator==( const os_host& host )
const
Returns
true if this host has the same value as host
.
aliases
const
vector< string >& aliases() const
Returns
a vector of aliases for this host.
defined
bool
defined() const
Returns
true if this host is defined.
ip_addresses
const
vector< os_ip_address >& ip_addresses() const
Returns
a vector of IP addresses for this host.
my_host
/*
static */ const os_host& my_host()
Returns
a reference to the os_host that represents the
local host.
name
string
name() const
Returns
the host name.
print
void
print( ostream& stream )
const
Prints
the host information to stream .
Non-Member Functions
<<
ostream&
operator<<( ostream& stream ,
const os_host& host )
Prints host
to stream .
Universal Streaming Service
#include <ospace/uss/network.h>
<<
os_bstream&
operator<<( os_bstream& stream ,
const os_host& host )
Writes host
to stream .
>>
os_bstream&
operator>>( os_bstream& stream ,
os_host& host )
Reads host
from stream .
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.