Meta::MServer Class Reference

A general-purpose network server base class. More...

#include <MServer.h>

List of all members.

Public Member Functions

 MServer (MProcTask *task, MAuth *auth)
virtual ~MServer ()
MAuthauth ()
const MAuthauth () const
MProcTasktask ()
bool listen (int port)
virtual MNetProcserverSpawn ()=0
virtual bool onConnect (const mstr &host)
virtual bool onAuthSuccess (mvar &session)
virtual void onAuthFail (mvar &session)

Detailed Description

A general-purpose network server base class.

Used to implement network client applications. The distinction between server and client is somewhat arbitrary, other than the fact that the client initiates the connection and that MServer provides an authentication mechanism using MAuth. Refer to MClient for more information.


Constructor & Destructor Documentation

Meta::MServer::MServer ( MProcTask task,
MAuth auth 
)

Constructor.

Parameters:
task The task to used for concurrency and communications processing.
auth The authenticator, null may be passed to bypass authentication.
virtual Meta::MServer::~MServer (  )  [virtual]

Destructor.


Member Function Documentation

const MAuth* Meta::MServer::auth (  )  const
Returns:
The authenticator this MServer was constructed with.
MAuth* Meta::MServer::auth (  ) 
Returns:
The authenticator this MServer was constructed with.
bool Meta::MServer::listen ( int  port  ) 

Begin listening on the specified port.

Returns:
true on success, fails if the port is in use.
virtual void Meta::MServer::onAuthFail ( mvar session  )  [virtual]

Called upon authentication failure.

Parameters:
session The session data the client attempted to connect with.
virtual bool Meta::MServer::onAuthSuccess ( mvar session  )  [virtual]

Called after authentication success.

Parameters:
session The session data the client connected with.
Returns:
true to allow this client to proceed. Default behavior is simply to return true.
virtual bool Meta::MServer::onConnect ( const mstr host  )  [virtual]
Parameters:
host The host/IP address of the client attempting to connect.
Returns:
true to allow this client to connect. Default behavior is simply to return true.
virtual MNetProc* Meta::MServer::serverSpawn (  )  [pure virtual]
Returns:
The application-specific MNetProc subclass that is created to handle communication and processing with a a client. User is responsible for destroying any MNetProc's created.
MProcTask* Meta::MServer::task (  ) 
Returns:
The task that the client was constructed with.

The documentation for this class was generated from the following file:

Generated on Wed Mar 24 16:22:43 2010 for AndroMeta by  doxygen 1.6.1