It is up to this method, designed to be overriden (this implementation throws a ServerStreamSocketException in all cases), to initialize the AnonymousProtocolAwareStreamSocket instance it is given, which includes setting its associated protocol server.
void MyActualServer::accepted( AnonymousStreamSocket & newConnection ) throw( ServerStreamSocketException ) {
AnonymousProtocolAwareStreamSocket * toCustomize = dynamic_cast<AnonymousProtocolAwareStreamSocket *>( newConnection ) ;
toCustomize->setProtocolServer( new MySpecificProtocol(...) ) ;
}
ServerStreamSocketException | in all cases. |