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

TAsyncSocket Class Template Reference
[SocketsTemplates]

Inheritance diagram for TAsyncSocket:
Collaboration diagram for TAsyncSocket:

List of all members.


Detailed Description

template<class Base, class Manager, class Callback>
class JetByteTools::Socket::TAsyncSocket< Base, Manager, Callback >

A template class that provides most of the functionality that is shared between all socket types.

Protected Member Functions

 TAsyncSocket (JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex numberOfUserDataSlots, PerSocketBufferPoolingLimit maxPooledBuffers, ConsecutiveSocketOperations maxConsecutiveOperations, bool trackReferences=true)
 Create a socket with the specified number of user data slots.
 TAsyncSocket (const TAsyncSocket &rhs)
 ~TAsyncSocket ()
TAsyncSocketoperator= (const TAsyncSocket &rhs)
virtual const
std::string & 
GetIdentifierA () const
virtual
JetByteTools::Core::_tstring 
GetIdentifier () const
bool IsLockedByThisThread () const override
JetByteTools::IO::IBuffer::SequenceNumber GetNextOperationSequenceNumber () override
JetByteTools::IO::CSmartBuffer Allocate () override
JetByteTools::IO::CSmartBuffer AllocateCustomSizedBuffer (JetByteTools::IO::IBuffer::BufferSize bufferSize) override
JetByteTools::IO::CSmartBuffer Allocate (JetByteTools::IO::IAllocateBuffer &allocator) override
JetByteTools::IO::CSmartBuffer AllocateCustomSizedBuffer (JetByteTools::IO::IAllocateBuffer &allocator, JetByteTools::IO::IBuffer::BufferSize bufferSize) override
void AddBufferToPool (JetByteTools::IO::IBuffer &buffer) override
virtual bool CloseSocket ()
virtual void Read ()
virtual void Read (JetByteTools::IO::CSmartBuffer &buffer)
virtual void Read (JetByteTools::IO::IBuffer *pBuffer)
virtual void Write (const char *pData, JetByteTools::IO::IStream::DataLength dataLength)
virtual void Write (const BYTE *pData, JetByteTools::IO::IStream::DataLength dataLength)
virtual void Write (JetByteTools::IO::CSmartBuffer &buffer)
virtual void Write (JetByteTools::IO::IIterateableBufferChain &buffers)
virtual bool TryRead ()
virtual bool TryRead (JetByteTools::IO::CSmartBuffer &buffer)
virtual bool TryRead (JetByteTools::IO::IBuffer *pBuffer)
virtual bool TryWrite (const char *pData, JetByteTools::IO::IStream::DataLength dataLength)
virtual bool TryWrite (const BYTE *pData, JetByteTools::IO::IStream::DataLength dataLength)
virtual bool TryWrite (JetByteTools::IO::CSmartBuffer &buffer)
virtual bool TryWrite (JetByteTools::IO::IIterateableBufferChain &buffers)
virtual void Shutdown ()
virtual void Shutdown (ShutdownHow how)
virtual bool AbortConnection ()
virtual CAddress GetLocalAddress () const
virtual CAddress GetRemoteAddress () const
virtual void AddRef ()
virtual void Release ()
virtual bool WeOwnOnlyReference () const
virtual void Attach (IPoolableSocketManager &manager, ISocketCallback &callback, SOCKET socket)
virtual bool AbortConnectionIfManagedBy (const IPoolableSocketManager &manager, ConnectionClosureReason reason)
virtual void DumpIfManagedBy (const IPoolableSocketManager &manager) const
virtual bool AddRefIfPossible ()
virtual DWORD GetError (const OVERLAPPED &overlapped)
 Implement IHandler.
virtual void HandleOperation (JetByteTools::IO::IBuffer *pBuffer, DWORD ioSize, DWORD lastError)
virtual void * GetUserPointer (JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex index) const
virtual void SetUserPointer (JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex index, void *pData)
virtual ULONG_PTR GetUserData (JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex index) const
virtual void SetUserData (JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex index, ULONG_PTR data)
virtual void WriteCompleted ()
virtual
JetByteTools::Core::IReentrantLockableObject
GetLock () const
virtual void Accepted ()
virtual void AboutToConnect ()
virtual void Connected ()
virtual
ConnectionDirection 
GetConnectionDirection () const
virtual SOCKET GetSocket () const
virtual bool CanWrite (size_t numBuffers=1)
virtual bool CanIssueFilteredWrite ()
virtual bool WritePending ()
virtual void ForceWritePending ()
virtual
JetByteTools::IO::CSmartBuffer 
GetNextOperation (JetByteTools::IO::CSmartBuffer &buffer)
virtual bool ProcessAndGetNextOperation (JetByteTools::IO::CSmartBuffer &buffer)
virtual void AllowOperationProcessingTransfer ()
virtual void OnAttach ()
virtual void CancelIOIfNecessary ()
virtual void OnDetach ()
void IncrementReferenceCountFromZero ()
virtual bool OnFinalRelease ()
bool IsValid () const

Protected Attributes

Manager * m_pManager
Callback * m_pCallback
SOCKET m_socket
JetByteTools::Core::CAtomicLong m_outstandingWrites
JetByteTools::Core::CAtomicBool m_writeShutdown
JetByteTools::Core::CAtomicBool m_readShutdown
ConnectionDirection m_direction
JetByteTools::Core::CReentrantLockableObjectTracksLockingThread m_lock

Constructor & Destructor Documentation

TAsyncSocket ( JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex  numberOfUserDataSlots,
PerSocketBufferPoolingLimit  maxPooledBuffers,
ConsecutiveSocketOperations  maxConsecutiveOperations,
bool  trackReferences = true 
) [inline, protected]

Create a socket with the specified number of user data slots.

TAsyncSocket ( const TAsyncSocket< Base, Manager, Callback > &  rhs  )  [protected]

~TAsyncSocket (  )  [inline, protected]


Member Function Documentation

TAsyncSocket& operator= ( const TAsyncSocket< Base, Manager, Callback > &  rhs  )  [protected]

const std::string & GetIdentifierA (  )  const [inline, protected, virtual]

JetByteTools::Core::_tstring GetIdentifier (  )  const [inline, protected, virtual]

bool IsLockedByThisThread (  )  const [inline, override, protected]

JetByteTools::IO::IBuffer::SequenceNumber GetNextOperationSequenceNumber (  )  [inline, override, protected]

JetByteTools::IO::CSmartBuffer Allocate (  )  [inline, override, protected]

JetByteTools::IO::CSmartBuffer AllocateCustomSizedBuffer ( JetByteTools::IO::IBuffer::BufferSize  bufferSize  )  [inline, override, protected]

JetByteTools::IO::CSmartBuffer Allocate ( JetByteTools::IO::IAllocateBuffer allocator  )  [inline, override, protected]

JetByteTools::IO::CSmartBuffer AllocateCustomSizedBuffer ( JetByteTools::IO::IAllocateBuffer allocator,
JetByteTools::IO::IBuffer::BufferSize  bufferSize 
) [inline, override, protected]

void AddBufferToPool ( JetByteTools::IO::IBuffer &  buffer  )  [inline, override, protected]

bool CloseSocket (  )  [inline, protected, virtual]

void Read (  )  [inline, protected, virtual]

void Read ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

void Read ( JetByteTools::IO::IBuffer *  pBuffer  )  [inline, protected, virtual]

void Write ( const char *  pData,
JetByteTools::IO::IStream::DataLength  dataLength 
) [inline, protected, virtual]

void Write ( const BYTE pData,
JetByteTools::IO::IStream::DataLength  dataLength 
) [inline, protected, virtual]

void Write ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

void Write ( JetByteTools::IO::IIterateableBufferChain buffers  )  [inline, protected, virtual]

bool TryRead (  )  [inline, protected, virtual]

bool TryRead ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

bool TryRead ( JetByteTools::IO::IBuffer *  pBuffer  )  [inline, protected, virtual]

bool TryWrite ( const char *  pData,
JetByteTools::IO::IStream::DataLength  dataLength 
) [inline, protected, virtual]

bool TryWrite ( const BYTE pData,
JetByteTools::IO::IStream::DataLength  dataLength 
) [inline, protected, virtual]

bool TryWrite ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

bool TryWrite ( JetByteTools::IO::IIterateableBufferChain buffers  )  [inline, protected, virtual]

void Shutdown (  )  [inline, protected, virtual]

void Shutdown ( ShutdownHow  how  )  [inline, protected, virtual]

Reimplemented in CDatagramSocket.

bool AbortConnection (  )  [inline, protected, virtual]

CAddress GetLocalAddress (  )  const [inline, protected, virtual]

CAddress GetRemoteAddress (  )  const [inline, protected, virtual]

Reimplemented in CDatagramServerSocket.

void AddRef (  )  [inline, protected, virtual]

void Release (  )  [inline, protected, virtual]

bool WeOwnOnlyReference (  )  const [inline, protected, virtual]

void Attach ( IPoolableSocketManager manager,
ISocketCallback callback,
SOCKET  socket 
) [inline, protected, virtual]

bool AbortConnectionIfManagedBy ( const IPoolableSocketManager manager,
ConnectionClosureReason  reason 
) [inline, protected, virtual]

void DumpIfManagedBy ( const IPoolableSocketManager manager  )  const [inline, protected, virtual]

bool AddRefIfPossible (  )  [inline, protected, virtual]

DWORD GetError ( const OVERLAPPED overlapped  )  [inline, protected, virtual]

Implement IHandler.

void HandleOperation ( JetByteTools::IO::IBuffer *  pBuffer,
DWORD  ioSize,
DWORD  lastError 
) [inline, protected, virtual]

void * GetUserPointer ( JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex  index  )  const [inline, protected, virtual]

void SetUserPointer ( JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex  index,
void *  pData 
) [inline, protected, virtual]

ULONG_PTR GetUserData ( JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex  index  )  const [inline, protected, virtual]

void SetUserData ( JetByteTools::Core::IIndexedOpaqueUserData::UserDataIndex  index,
ULONG_PTR  data 
) [inline, protected, virtual]

void WriteCompleted (  )  [inline, protected, virtual]

JetByteTools::Core::IReentrantLockableObject & GetLock (  )  const [inline, protected, virtual]

void Accepted (  )  [inline, protected, virtual]

void AboutToConnect (  )  [inline, protected, virtual]

void Connected (  )  [inline, protected, virtual]

ConnectionDirection GetConnectionDirection (  )  const [inline, protected, virtual]

SOCKET GetSocket (  )  const [inline, protected, virtual]

bool CanWrite ( size_t  numBuffers = 1  )  [inline, protected, virtual]

bool CanIssueFilteredWrite (  )  [inline, protected, virtual]

bool WritePending (  )  [inline, protected, virtual]

void ForceWritePending (  )  [inline, protected, virtual]

JetByteTools::IO::CSmartBuffer GetNextOperation ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

bool ProcessAndGetNextOperation ( JetByteTools::IO::CSmartBuffer buffer  )  [inline, protected, virtual]

void AllowOperationProcessingTransfer (  )  [inline, protected, virtual]

virtual void OnAttach (  )  [inline, protected, virtual]

Reimplemented in CSequencedStreamSocket, and CStreamSocket.

virtual void CancelIOIfNecessary (  )  [inline, protected, virtual]

Reimplemented in CStreamSocket.

virtual void OnDetach (  )  [inline, protected, virtual]

Reimplemented in CSequencedStreamSocket.

void IncrementReferenceCountFromZero (  )  [inline, protected]

bool OnFinalRelease (  )  [inline, protected, virtual]

bool IsValid (  )  const [inline, protected]


Member Data Documentation

Manager* m_pManager [protected]

Callback* m_pCallback [protected]

SOCKET m_socket [protected]

JetByteTools::Core::CReentrantLockableObjectTracksLockingThread m_lock [mutable, protected]


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