SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Encapsulates a complete Internet address that includes type information, a host, and a port. More...
#include <rw/network/RWInetAddr.h>
Public Member Functions | |
RWInetAddr () | |
RWInetAddr (const RWInetPort &port) | |
RWInetAddr (int port) | |
RWInetAddr (const RWInetPort &port, const RWInetHost &host, short type=SOCK_STREAM, short protocol=0) | |
RWInetAddr (const sockaddr_in &addr, short type=SOCK_STREAM, short protocol=0) | |
RWInetAddr (const RWCString &s) | |
virtual void | prepare () const |
virtual RWSockType | addressType () const |
const RWInetPort & | port () const |
const RWInetHost & | host () const |
const RWInetPort & | getPort () const |
const RWInetHost & | getHost () const |
virtual sockaddr * | asSockaddr () const |
virtual size_t | sockaddrSize () const |
virtual RWCString | id (unsigned level=0) const |
bool | operator== (const RWInetAddr &rhs) const |
bool | operator!= (const RWInetAddr &rhs) const |
Static Public Member Functions | |
static bool | is (const RWSockAddrBase &) |
static RWInetAddr | as (const RWSockAddrBase &) |
Related Functions | |
(Note that these are not member functions.) | |
std::istream & | operator>> (std::istream &strm, RWInetAddr &x) |
Encapsulates a complete Internet address that includes type information, a host, and a port.
RWInetAddr addr(80, "www.roguewave.com");
RWInetAddr::RWInetAddr | ( | ) |
Constructs an address for a TCP/IP Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInetAddr::RWInetAddr | ( | const RWInetPort & | port | ) |
Constructs an address for a TCP/IP Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInetAddr::RWInetAddr | ( | int | port | ) |
Constructs an address for a TCP/IP Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInetAddr::RWInetAddr | ( | const RWInetPort & | port, | |
const RWInetHost & | host, | |||
short | type = SOCK_STREAM , |
|||
short | protocol = 0 | |||
) |
Constructs an address for a TCP/IP Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInetAddr::RWInetAddr | ( | const sockaddr_in & | addr, | |
short | type = SOCK_STREAM , |
|||
short | protocol = 0 | |||
) |
Constructs an address for a TCP/IP Internet connection. The constructor that takes only a port argument creates a special address used to bind to any of the network interfaces on the machine on which the process is running. This is done, for example, when you are setting a server address. An address created using the default constructor binds to an arbitrary port number on any network interface on the local machine. These constructors do not block.
RWInetAddr::RWInetAddr | ( | const RWCString & | s | ) |
Constructs an address from s, where s has the form type:host:port
. Both type
and host
are optional. If type
is supplied, it must be stream
for a stream socket address or dgram
for a datagram socket. The RWCString should contain 7-bit US-ASCII data.
virtual RWSockType RWInetAddr::addressType | ( | ) | const [virtual] |
Returns the address type.
Implements RWSockAddrBase.
static RWInetAddr RWInetAddr::as | ( | const RWSockAddrBase & | ) | [static] |
Casts addr to RWInetAddr, if appropriate. Otherwise it throws an RWSockWrongAddressTypeError exception.
virtual sockaddr* RWInetAddr::asSockaddr | ( | ) | const [virtual] |
Returns a pointer to an internal representation of the address that was cast to a sockaddr
structure, as defined by the sockets and TLI APIs (TLI is the Unix System V network communication interface). The pointer is to an internal data structure, so it becomes invalid if self
is changed in any way or goes out of scope. If the address has no representation as a sockaddr
, a null pointer is returned.
Implements RWSockAddrBase.
const RWInetHost & RWInetAddr::getHost | ( | ) | const [inline] |
Returns the host part of the address.
const RWInetPort & RWInetAddr::getPort | ( | ) | const [inline] |
Returns the port part of the address.
const RWInetHost & RWInetAddr::host | ( | ) | const [inline] |
Returns the host part of the address.
virtual RWCString RWInetAddr::id | ( | unsigned | level = 0 |
) | const [virtual] |
Returns a string describing self
. The verbosity of the output is controlled by level where level=0
is the most basic output, and level=9
is the most verbose. The RWCString should contain 7-bit US-ASCII data.
Implements RWSockAddrBase.
static bool RWInetAddr::is | ( | const RWSockAddrBase & | ) | [static] |
Returns true
if addr is an RWInetAddr.
bool RWInetAddr::operator!= | ( | const RWInetAddr & | rhs | ) | const |
Returns true
if the two address objects are not equal.
bool RWInetAddr::operator== | ( | const RWInetAddr & | rhs | ) | const |
Returns true
if the two address objects are equal.
const RWInetPort & RWInetAddr::port | ( | ) | const [inline] |
Returns the port part of the address.
virtual void RWInetAddr::prepare | ( | ) | const [virtual] |
Ensures that future calls do not block on this address. If necessary, this function looks up the IP address and port number from the host name and service name. It is not necessary to call prepare(), but if you don't, future calls may block. No exceptions are thrown from prepare().
Reimplemented from RWSockAddrBase.
virtual size_t RWInetAddr::sockaddrSize | ( | ) | const [virtual] |
Returns the size of an internal representation of the socket address defined by the sockets.
Implements RWSockAddrBase.
std::istream & operator>> | ( | std::istream & | strm, | |
RWInetAddr & | x | |||
) | [related] |
Reads an address x from input stream strm.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.