ip_address


A TCP/IP host has one IP address for each network to which it is connected. If a host is connected to more than one network, that host is called a multihomed host .

An IP address is stored as a 32-bit number and is often displayed as four one-byte numbers. IP addresses are classified as A, B, C, or D addresses and often have a symbolic equivalent. For example, the following table lists the numeric IP address equivalent for several symbolic addresses.
Many of the network-related features of Network<ToolKit> either require IP addresses or return them. You can construct an os_ip_address object from either a symbolic name or from the symbolic name's numeric equivalent.
 
Symbolic Name Numeric Equivalent

jupiter

128.51.200.1

saturn

128.51.200.2

mars

128.51.200.3

neptune

128.51.200.4

Example <ospace/network/examples/ipaddr1.cpp>
#include <iostream>
#include <ospace/network.h>

void
main()
  {
  os_network_toolkit initialize;
  os_ip_address addr1( "shazam" );
  cout << addr1 << " is a class type " << addr1.class_type();
  cout << " address" << endl;
  os_ip_address addr2( "128.41.200.7" );
  cout << addr2 << endl;
  }
os_ip_address( 200.1.1.3 ) is a class type C address
os_ip_address( 128.41.200.7 )

Conversions enable interchangeable use of IP addresses and in_addr structures.


Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.