The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CSocketAllocator Class Reference
[Socket allocatorsOpaque user data]

Inheritance diagram for CSocketAllocator:
Collaboration diagram for CSocketAllocator:

List of all members.


Detailed Description

A base class for socket allocation. There are several different types of socket that are used through the library. Most of the work involved in allocating sockets and managing a pool of sockets is the same for all types. The only things that change are the type of the socket that is being allocated and the way the socket is created. Derived classes provide this functionality.

Public Types

typedef unsigned short SocketCount

Static Public Attributes

static const SocketCount NoPooledSockets = 0xFFFF
 Pass this value as maxFreeSockets to constructors to create an allocator that doesn't pool sockets at all.

Protected Member Functions

 CSocketAllocator (SocketCount maxFreeSockets, PerSocketBufferPoolingLimit maxPooledBuffers, ConsecutiveSocketOperations maxConsecutiveOperations)
 CSocketAllocator (IMonitorSocketAllocation &monitor, SocketCount maxFreeSockets, PerSocketBufferPoolingLimit maxPooledBuffers, ConsecutiveSocketOperations maxConsecutiveOperations)
 CSocketAllocator (const CSocketAllocator &rhs)
virtual ~CSocketAllocator ()
CSocketAllocatoroperator= (const CSocketAllocator &rhs)
SocketCount EnlargePool (SocketCount socketsToAdd)
 Create socketsToAdd sockets and add them to the pool. Returns the number of sockets now in the pool.
IPoolableSocketAllocatePoolableSocket (IPoolableSocketManager &manager, ISocketCallback &callback, SOCKET theSocket)
 Allocate an instance of IPoolableSocket which has the supplied manager as its manager, the supplied callback interface for callbacks and which is attached to the supplied SOCKET.
virtual void ReleaseSocket (IPoolableSocket &socket)
 Release the supplied socket and, either return it to the pool for later reuse or destroy it.
virtual DWORD AbortMyConnections (const IPoolableSocketManager &manager, ConnectionClosureReason reason)
 Walk the list of active connections and abort any that are managed by the supplied manager. Returns the number of active connections that were aborted. Note that the allocator can support more than max(SocketCount) active connections; the size of SocketCount only limits the number of pooled connections.
virtual void DumpMyConnections (const IPoolableSocketManager &manager) const
virtual bool ReleaseSockets ()
 Forcibly release, and destroy, all active and inactive sockets. Use with care and only in a debugging/system shutdown scenario.
virtual
JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex 
RequestUserDataSlot (const JetByteTools::Core::_tstring &name)
 Implement IProvideUserData.
virtual
JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex 
LockUserDataSlots ()

Member Typedef Documentation


Constructor & Destructor Documentation

CSocketAllocator ( SocketCount  maxFreeSockets,
PerSocketBufferPoolingLimit  maxPooledBuffers,
ConsecutiveSocketOperations  maxConsecutiveOperations 
) [protected]

CSocketAllocator ( IMonitorSocketAllocation monitor,
SocketCount  maxFreeSockets,
PerSocketBufferPoolingLimit  maxPooledBuffers,
ConsecutiveSocketOperations  maxConsecutiveOperations 
) [protected]

CSocketAllocator ( const CSocketAllocator rhs  )  [protected]

~CSocketAllocator (  )  [protected, virtual]


Member Function Documentation

CSocketAllocator& operator= ( const CSocketAllocator rhs  )  [protected]

CSocketAllocator::SocketCount EnlargePool ( SocketCount  socketsToAdd  )  [protected]

Create socketsToAdd sockets and add them to the pool. Returns the number of sockets now in the pool.

IPoolableSocket & AllocatePoolableSocket ( IPoolableSocketManager manager,
ISocketCallback callback,
SOCKET  theSocket 
) [protected]

Allocate an instance of IPoolableSocket which has the supplied manager as its manager, the supplied callback interface for callbacks and which is attached to the supplied SOCKET.

DWORD AbortMyConnections ( const IPoolableSocketManager manager,
ConnectionClosureReason  reason 
) [protected, virtual]

Walk the list of active connections and abort any that are managed by the supplied manager. Returns the number of active connections that were aborted. Note that the allocator can support more than max(SocketCount) active connections; the size of SocketCount only limits the number of pooled connections.

Reimplemented in TSocketAllocator, TSocketAllocator< JetByteTools::Socket::IAllocateDatagramSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateStreamSockets >, TSocketAllocator< JetByteTools::Socket::IAllocateSequencedStreamSockets >, and TSocketAllocator< JetByteTools::Socket::IAllocateDatagramServerSockets >.

bool ReleaseSockets (  )  [protected, virtual]


Member Data Documentation

Pass this value as maxFreeSockets to constructors to create an allocator that doesn't pool sockets at all.


Generated on Sun Sep 12 19:10:37 2021 for The Server Framework - v7.4 by doxygen 1.5.3