Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

net::ClientHandler Class Reference

#include <ClientHandler.h>

Inheritance diagram for net::ClientHandler:

Thread Runnable Object List of all members.

Detailed Description

A class for handling multiple client request simultaneously in a server.

ClientHandlers run concurrently in different threads and handle the requests using a specified protocol. All the methods in this class are MT-safe.


Public Methods

 ClientHandler (Protocol *p, int max=-1, int detachState=PTHREAD_CREATE_JOINABLE) throw (TooManyInstancesException&, MutexException&)
 Construct a new client handler.

 ClientHandler (int max, Protocol *p=NULL, int detachState=PTHREAD_CREATE_JOINABLE) throw (TooManyInstancesException&, MutexException&)
 ClientHandler (Protocol &p, int max=-1, int detachState=PTHREAD_CREATE_JOINABLE) throw (TooManyInstancesException&, MutexException&)
 ClientHandler (int max, Protocol &p, int detachState=PTHREAD_CREATE_JOINABLE) throw (TooManyInstancesException&, MutexException&)
virtual ~ClientHandler ()
 Destroy a ClientHandler.

void setProtocol (Protocol *p)
 Set the protocol used by this client handler.

void setProtocol (Protocol &p)
 Set the protocol used by this client handler.

ProtocolgetProtocol (void)
 Get the protocol used by this client handler.

void run (void)

Static Public Methods

int getInstanceCount (void)
 Get the current number of ClientHandler instances.


Constructor & Destructor Documentation

net::ClientHandler::ClientHandler Protocol   p,
int    max = -1,
int    detachState = PTHREAD_CREATE_JOINABLE
throw (TooManyInstancesException&, MutexException&)
 

Construct a new client handler.

Use the given protocol to handle requests. Note that if a protocol is stateless, it can be shared between multiple clients.

Parameters:
p  the protocol to be used
max  the maximum number of ClientHandler instances. "-1" means no limits.
Exceptions:
TooManyInstancesException  & if the maximum number of instances would be exceeded.
MutexException  & if the instance count mutex cannot be acquired. This should never happen.

net::ClientHandler::~ClientHandler   [virtual]
 

Destroy a ClientHandler.

Exceptions:
MutexException  & if the instance count mutex cannot be acquired. This should never happen.


Member Function Documentation

int net::ClientHandler::getInstanceCount void    [inline, static]
 

Get the current number of ClientHandler instances.

This may help in limiting the number of allowed concurrent connections.

Returns:
the current number of ClientHandler instances

void net::ClientHandler::setProtocol Protocol   p
 

Set the protocol used by this client handler.

The memory referenced by p is not automatically released.

void net::ClientHandler::setProtocol Protocol   p
 

Set the protocol used by this client handler.

The memory pointed by p is automatically released.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.