Essential Networking Module User’s Guide : PART II The Networking Package : Chapter 9 Servers : Socket Listeners
Socket Listeners
RWSocketListener is an abstraction that takes care of many of the details of handling the server side socket. It acts at the Communication Services Layer, much like RWPortal. It can automatically close the socket on destruction and returns an RWSocketPortal to the connected client. Assuming that addr is an RWSockAddr or a derived address type, the following illustrates how you would accept a connection using RWSocketListener:
 
RWSocketListener sock(addr); // 1
RWSocketPortal conn = sock.accept(); // 2
//1 Binds the listener to the address specified in addr and sets it up to start accepting connections.
//2 Accepts an incoming connection and returns it as an RWSocketPortal instance.