C++ common classes
General purpose classes for use across projects (Apache license)
CPServer Class Reference

CPServer.h: interface for the CPServer class. More...

#include <Cpserver.h>

Inheritance diagram for CPServer:
CBaseSocket

List of all members.

Public Member Functions

 CPServer (CP_CONNECTION_HANDLER_ARRAY &cPConnectionHandlers)
 constructor
virtual ~CPServer ()
BOOL Listen (int nConnectionBacklog=SOMAXCONN)
void ShutdownAll ()
time_t GetTimeStarted ()

Protected Member Functions

virtual void CleanupArray (BOOL bTerminateAll=FALSE)
 Clean up array.
virtual BOOL Accept ()
 Accept connections.
virtual CPConnectionAllocateSocketClass (struct sockaddr *pAddr)=0

Static Protected Member Functions

static unsigned AcceptConnection (void *pVoid)
 Listening thread.

Protected Attributes

CP_CONNECTION_HANDLER_ARRAY cHandlers
 data member
vector< CPConnection * > cSocketArray
 Array of CPConnection objects created.
XPLAT_HANDLE hThread
time_t tStarted
CXPlatCriticalSection cCritSocketArray
int iNumHandlers

Detailed Description

CPServer.h: interface for the CPServer class.

_MSC_VER > 1000 Pooled connection server class. Handles multiple TCP connections with just a connection accept thread and an I/O thread, making it highly scalable

Definition at line 34 of file Cpserver.h.


Constructor & Destructor Documentation

CPServer::CPServer ( CP_CONNECTION_HANDLER_ARRAY cPConnectionHandlers)

constructor

Definition at line 33 of file Cpserver.cpp.

CPServer::~CPServer ( ) [virtual]

Definition at line 41 of file Cpserver.cpp.


Member Function Documentation

BOOL CPServer::Accept ( ) [protected, virtual]

Accept connections.

Definition at line 106 of file Cpserver.cpp.

unsigned CPServer::AcceptConnection ( void pVoid) [static, protected]

Listening thread.

Definition at line 310 of file Cpserver.cpp.

virtual CPConnection* CPServer::AllocateSocketClass ( struct sockaddr *  pAddr) [protected, pure virtual]

Pure virtual functions allocate and dallocate a derivative of CConnectionSocket Redefine in derived class

void CPServer::CleanupArray ( BOOL  bTerminateAll = FALSE) [protected, virtual]

Clean up array.

Definition at line 250 of file Cpserver.cpp.

Definition at line 321 of file Cpserver.cpp.

BOOL CPServer::Listen ( int  nConnectionBacklog = SOMAXCONN)

Definition at line 48 of file Cpserver.cpp.

Definition at line 292 of file Cpserver.cpp.


Member Data Documentation

Definition at line 68 of file Cpserver.h.

data member

Array of CPConnectionHandlers. Use the one with the least connections.

Definition at line 63 of file Cpserver.h.

vector<CPConnection *> CPServer::cSocketArray [protected]

Array of CPConnection objects created.

Definition at line 65 of file Cpserver.h.

Definition at line 66 of file Cpserver.h.

int CPServer::iNumHandlers [protected]

Definition at line 69 of file Cpserver.h.

time_t CPServer::tStarted [protected]

Definition at line 67 of file Cpserver.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines