RWInetAddrRWSockAddrBase
Networking Tools: Network Communication Classes (net library)
addressType() as() asSockaddr() |
host() id() is() |
operator<<() operator=() port() |
prepare() sockaddrSize() |
#include <rw/toolpro/inetaddr.h> RWInetAddr addr(80, "www.roguewave.com");
net, tls (and possibly std)
Constructs a complete internet address that includes type information, a host, and a port.
RWInetAddr(); RWInetAddr(const RWInetPort& 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);
Constructs an address for a TCP/IP internet connection. Note that the RWInetPort and RWInetHost classes have conversion constructors that take either a string or an integer, so you can specify either a string or an integer for either the port or the host. 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 the machine has. These constructors do not block.
RWInetAddr(const RWCString& s);
Constructs an address from s, where s has the form type:host:port and 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.
RWInetAddr(const RWInetAddr& x);
Creates a copy of x.
virtual RWSockType addressType() const;
Returns the address type.
virtual sockaddr* asSockaddr() const;
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. 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.
RWInetHost host() const;
Returns the host part of the address.
RWCString id(unsigned level=0);
Returns a string describing self. The verbosity of the output is controlled by level with level=0 being the most basic output and level=9 the most verbose.
RWInetPort port() const;
Returns the port part of the address.
virtual void prepare() const;
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().
virtual size_t sockaddrSize() const;
Returns the size of an internal representation of the socket address defined by the sockets.
RWInetAddr& operator=(const RWInetAddr& x);
Makes self a copy of x. The previous contents of self are lost.
RWBoolean is(const RWSockAddrBase& addr);
Returns TRUE if addr is an RWInetAddr.
RWInetAddr as(const RWSockAddrBase& addr);
Casts addr to RWInetAddr, if appropriate. Otherwise it throws an RWSockWrongAddressType exception.
ostream& operator<<(ostream& strm, const RWInetAddr& x);
Outputs a representation of x on strm. The representation is generated using the member function x.id() with level=0.
Note: This class does not have an extraction (>>) operator.
©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.