Encapsulates a complete Internet address that includes type information, a host, and a port.
More...
#include <rw/network/RWInetAddr.h>
|
(Note that these are not member symbols.)
|
std::istream & | operator>> (std::istream &strm, RWInetAddr &x) |
|
Encapsulates a complete Internet address that includes type information, a host, and a port.
- Example
Encapsulates a complete Internet address that includes type information, a host, and a port.
Definition RWInetAddr.h:68
◆ RWInetAddr() [1/6]
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() [2/6]
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() [3/6]
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() [4/6]
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() [5/6]
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() [6/6]
RWInetAddr::RWInetAddr |
( |
const RWCString & | s | ) |
|
Constructs an address from the ASCII string 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. If not specified, type
defaults to a value of stream
and host
to a value of "ANY"
.
◆ addressType()
virtual RWSockType RWInetAddr::addressType |
( |
| ) |
const |
|
virtual |
◆ as()
◆ asSockaddr()
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.
◆ getHost()
Returns the host part of the address.
◆ getPort()
Returns the port part of the address.
◆ host()
Returns the host part of the address.
◆ id()
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. If not specified, a default value of 0 is used and is guaranteed not to block.
Grammar Definitions
type ::= <the result of addressType().id(level)>
hostname ::= <the result of getHost().id(level)>
port ::= <the result of getPort().id(level)>
level | Calls prepare() | Output Grammar | Sample Output for id(level) given RWInetAddr(80, "127.0.0.1") |
0 | | hostname ":" port | 127.0.0.1:80 |
1 | | hostname ":" port | 127.0.0.1:80 |
2 | | type ":" hostname ":" port | inet:stream:127.0.0.1:80 |
3 | X | hostname ":" port | localhost:80 |
4 | X | hostname ":" port | localhost(127.0.0.1):80(http) |
5 | X | hostname ":" port | localhost(127.0.0.1):80(http) |
6 | X | type ":" hostname ":" port | inet:stream:localhost:80 |
7 | X | type ":" hostname ":" port | inet:stream:localhost(127.0.0.1):80(http) |
8 | X | type ":" hostname ":" port | inet:stream:localhost(127.0.0.1):80(http) |
9 | X | type ":" hostname ":" port | inet:stream:localhost(127.0.0.1):80(http,www,www-http) |
Implements RWSockAddrBase.
◆ is()
◆ operator!=()
bool RWInetAddr::operator!= |
( |
const RWInetAddr & | rhs | ) |
const |
Returns true
if the two address objects are not equal.
◆ operator==()
bool RWInetAddr::operator== |
( |
const RWInetAddr & | rhs | ) |
const |
Returns true
if the two address objects are equal.
◆ port()
Returns the port part of the address.
◆ prepare()
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.
◆ sockaddrSize()
virtual size_t RWInetAddr::sockaddrSize |
( |
| ) |
const |
|
virtual |
Returns the size of an internal representation of the socket address defined by the sockets.
Implements RWSockAddrBase.
◆ operator>>()
std::istream & operator>> |
( |
std::istream & | strm, |
|
|
RWInetAddr & | x ) |
|
related |
Reads an address x from input stream strm.