Essential Networking Module User’s Guide : PART II The Networking Package : Chapter 9 Servers : Socket Listeners
Socket Listeners
The 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 and acts much like RWPortal. It can automatically close the socket on destruction and returns Portal to the connected client. Assuming that addr is 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 Accepta an incoming connection and returns it as an RWSocketPortal instance.
The RWSocketListener class provides a function call operator to accept incoming connections. The function call operator is a simply a convenience and is used elsewhere in the documentation.