Understanding the Base Class
RWSockAddrBase is the root of the socket address class hierarchy. It is an abstract base class that contains member functions for recognizing and using a socket address. Most of the Networking package interfaces that need a socket address—for example, the interfaces that connect a socket client to a server—include a
const RWSockAddrBase& as a parameter. This means that you can use a reference to any of the classes derived from
RWSockAddrBase as an argument to these functions.
Because
RWSockAddrBase is an abstract class, you cannot instantiate an
RWSockAddrBase object directly. Instead you instantiate the appropriate derived class. When you know the address family, you can use an object of the type appropriate to that family.
For example, to create an Internet family address, you would instantiate an
RWInetAddr object, as shown below.
sock.connect( RWInetAddr(3010,"net.roguewave.com") );