CStreamSocketServer Class Reference

Inheritance diagram for CStreamSocketServer:

Inheritance graph
[legend]
Collaboration diagram for CStreamSocketServer:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ZeroByteReadConfiguration { NoZeroByteRead, ZeroByteAsyncRead, ZeroByteSyncRead }
 How we perform zero byte reads, if at all. More...
enum  { DefaultTCPBufferSize = 0 }
typedef unsigned int TCPBufferSize

Public Member Functions

 CStreamSocketServer (JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const bool sslActive, JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const bool sslActive, JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const bool sslActive, JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const bool sslActive, JetByteTools::SChannel::CCredentials &credentials, const bool verifyPeer, const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 CStreamSocketServer (const JetByteTools::Socket::IFullAddress &address, const JetByteTools::Socket::ListenBacklog listenBacklog, IStreamSocketServerCallback &callback, JetByteTools::IO::IIOPool &pool, JetByteTools::Socket::IAllocateSequencedStreamSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &bufferAllocator, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize, const ZeroByteReadConfiguration zeroByteReadConfiguration=NoZeroByteRead, JetByteTools::Socket::ILimitConnections &connectionLimiter=JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter)
 ~CStreamSocketServer ()
JetByteTools::Socket::CSmartStreamSocket SecureConnect (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
JetByteTools::Socket::CSmartStreamSocket SecureConnectNoThrow (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
JetByteTools::Socket::CSmartStreamSocket SecureAsyncConnect (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
JetByteTools::Socket::CSmartStreamSocket SecureAsyncConnectNoThrow (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
JetByteTools::Socket::CSmartStreamSocket SecureConnectAsyncIfAvailable (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
JetByteTools::Socket::CSmartStreamSocket SecureConnectAsyncIfAvailableNoThrow (const JetByteTools::Socket::IFullAddress &address, const void *pUserData, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
bool IsSecure (JetByteTools::Socket::IStreamSocket &socket) const
bool RequiresPeerVerification (JetByteTools::Socket::IStreamSocket &socket) const
void Renegotiate (JetByteTools::Socket::IStreamSocket &socket) const
void Renegotiate (JetByteTools::Socket::IStreamSocket &socket, const JetByteTools::SChannel::ClientAuthenticationRequirements requirements) const
void Shutdown (JetByteTools::Socket::IStreamSocket &socket) const
void SendAlert (JetByteTools::Socket::IStreamSocket &socket, const DWORD alertType, const DWORD alertNumber) const
void SessionControl (JetByteTools::Socket::IStreamSocket &socket, const DWORD sessionFlags) const
void SetAddressDetails (const IFullAddress &address, const ListenBacklog listenBacklog)
 Set the address to listen for connections on and the size of the listen backlog queue.
void SetThreadName (const JetByteTools::Win32::_tstring &threadName)
 Sets the name of the accept thread as displayed in the Visual Studio debugger to the supplied name. By default the constructor sets the name of the thread to "SocketServer". Note that this must be called before calling Start() for it to have an effect.
virtual void Start ()
virtual void StartAcceptingConnections ()
virtual void StopAcceptingConnections ()
virtual void InitiateShutdown ()
 Starts the shutdown process and returns immediately.
virtual void WaitForShutdownToComplete ()
 Initiates a shutdown (if one isn't already in progresss) and then waits for it to complete. Does not return until the shutdown has completed.
virtual bool WaitForShutdownToComplete (const Milliseconds timeout)
 Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't.
virtual void ForceShutdown ()
 If a shutdown is hung due to sockets still being active then you can force a shutdown to complete by calling this function. Note: USE WITH CARE!!! The usual usage pattern is to call WaitForShutdownToComplete() with a timeout and if that fails then to call ForceShutdown() to allow the object in question to be destroyed (in general the object would call WaitForShutdownToComplete() in its destructor and hang there!).
virtual
CSmartStreamSocket 
Connect (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
virtual
CSmartStreamSocket 
Connect (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0
 Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on failure to connect, the resulting stream socket is always connected and valid. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
virtual
CSmartStreamSocket 
ConnectNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
virtual
CSmartStreamSocket 
ConnectNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0 throw ()
 Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
virtual
CSmartStreamSocket 
AsyncConnect (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
virtual
CSmartStreamSocket 
AsyncConnect (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0
 Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on some failures to connect. The smart stream pointer is not connected until the IStreamSocketConnectionManagerCallback::OnConnectionEstablished() has been called and this may be before or after the function returns to the caller. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.
virtual
CSmartStreamSocket 
AsyncConnectNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
virtual
CSmartStreamSocket 
AsyncConnectNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0 throw ()
 Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.
virtual
CSmartStreamSocket 
ConnectAsyncIfAvailable (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)
virtual
CSmartStreamSocket 
ConnectAsyncIfAvailable (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0
 If the platform supports asynchronous connections for this address type then acts as an AsyncConnect() else acts as a ConnectNoThrow().
virtual
CSmartStreamSocket 
ConnectAsyncIfAvailableNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize) throw ()
virtual
CSmartStreamSocket 
ConnectAsyncIfAvailableNoThrow (const IFullAddress &address, const void *pUserData=0, const TCPBufferSize recvBufferSize=DefaultTCPBufferSize, const TCPBufferSize sendBufferSize=DefaultTCPBufferSize)=0 throw ()
 If the platform supports asynchronous connections for this address type then acts as an AsyncConnectNoThrow() else acts as a ConnectNoThrow().
virtual bool AsyncConnectAvailable (const IAddressType &addressType) const
 Returns true if the platform supports asynchronous connections for this address type.
virtual void AbortAllConnections ()
 Aborts all connections that are managed by this connection manager.
virtual void AddConnectionFilter (IFilterStreamSocketConnections &filter)
 Adds a connection filter to the connection manager. Connection filters are called in order to process calls with requests being called from "top to bottom" and completions being called from "bottom to top". For example, if filter A is added and then filter B is added and then we make a write request the data would be processed first by filter B and then by filter A (user -> B -> A -> wire). When a read completes.

Protected Member Functions

const IFullAddress & GetAddress () const
virtual void ReleaseSocket (IPoolableSocket &socket)
 Used to pass the socket back to the allocator when its reference count reaches 0.
virtual SOCKET CreateListeningSocket (SOCKET socket, const IAddress &address, const ListenBacklog listenBacklog)
 Called to convert the supplied socket to a socket which is listening on the supplied address with the specified "listen backlog" (if supported). Override if the standard behaviour doesn't work for your socket type...
CSmartStreamSocket Connect (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize)
CSmartStreamSocket ConnectNoThrow (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize) throw ()
CSmartStreamSocket AsyncConnect (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize)
CSmartStreamSocket AsyncConnectNoThrow (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize) throw ()
CSmartStreamSocket ConnectAsyncIfAvailable (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize)
CSmartStreamSocket ConnectAsyncIfAvailableNoThrow (const IFullAddress &address, const void *pUserData, const void *pFilterData, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize) throw ()
void ConnectionEstablished (IStreamSocketEx &socket, const IAddress &address)
void ConnectionFailed (IStreamSocketEx &socket, const IAddress &address, const DWORD lastError)
void AssociateDevice (SOCKET s, JetByteTools::IO::IHandler &handler) const
DWORD GetPoolThreadsTlsIndex () const
size_t GetPoolThreadsIdentifier () const
void PostIoOperation (JetByteTools::IO::IHandler &handler, JetByteTools::IO::IBuffer &buffer, const JetByteTools::IO::IBuffer::Operation operation, const bool forceDispatchToPool=true)
virtual void HandleOperation (IStreamSocketEx &socket, JetByteTools::IO::IBuffer &buffer, const DWORD ioSize, const DWORD lastError)
 Handles an I/O operation.
virtual void RequestRead (IStreamSocketEx &socket, JetByteTools::IO::IBuffer *pBuffer)
 Called by a socket to have the manager shedule a read operation to occur on one of the I/O threads.
virtual void RequestWrite (IStreamSocketEx &socket, JetByteTools::IO::IBuffer &buffer)
 Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads.
virtual void ExecuteWrite (IStreamSocketEx &socket, JetByteTools::IO::IBuffer &buffer)
 Called by a socket to have the manager actually perform a write operation. The socket controls this action as it may be responsible for sequencing buffers into the correct order before issuing the writes.
virtual
JetByteTools::IO::IBuffer
AllocateBuffer ()
 Allows the socket to access the buffer allocator that is being used by the manager so that it can generate write calls using the correct buffers. These write calls are the result of the non buffer based Write() and TryWrite() methods being called.
virtual void OnClientClose (IStreamSocketEx &socket)
 Called by the socket when a OnConnectionClientClose event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
virtual void OnConnectionReset (IStreamSocketEx &socket, const DWORD lastError)
 Called by the socket when a OnConnectionConnectionReset event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
virtual void OnConnectionClosed (IStreamSocketEx &socket)
 Called by the socket when a OnConnectionClosed event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.
CSmartStreamSocketEx AllocateSocket (SOCKET theSocket)
SOCKET CreateSocket (const IAddressType &addressType, const TCPBufferSize recvBufferSize, const TCPBufferSize sendBufferSize) const
void SetBufferSize (SOCKET s, const TCPBufferSize bufferSize, const int optionName) const
bool ConnectEx (SOCKET s, const struct sockaddr FAR *name, int namelen, PVOID lpSendBuffer, DWORD dwSendDataLength, LPDWORD lpdwBytesSent, LPOVERLAPPED lpOverlapped) const
 Loads, if necessary and available, and then calls ConnectEx(). If the function isn't available then an exception is thrown.
bool LoadConnectEx (SOCKET s) const
 Attempts to load ConnectEx() via a call to WSAIoctl(). Returns true if successful.
bool AcceptEx (SOCKET listenSocket, SOCKET acceptSocket, PVOID pOutputBuffer, DWORD receiveDataLength, DWORD localAddressLength, DWORD remoteAddressLength, LPDWORD bytesReceived, LPOVERLAPPED pOverlapped) const
 Loads, if necessary and available, and then calls AcceptEx(). If the function isn't available then an exception is thrown.
bool LoadAcceptEx (SOCKET s) const
 Attempts to load AcceptEx() via a call to WSAIoctl(). Returns true if successful.
void GetAcceptExSockaddrs (PVOID pOutputBuffer, DWORD receiveDataLength, DWORD localAddressLength, DWORD remoteAddressLength, LPSOCKADDR *pLocalSockaddr, LPINT pLocalSockaddrLength, LPSOCKADDR *pRemoteSockaddr, LPINT pRemoteSockaddrLength) const
 Loads, if necessary and available, and then calls GetAcceptExSockaddrs(). If the function isn't available then an exception is thrown.
bool LoadGetAcceptExSockaddrs (SOCKET s) const
 Attempts to load GetAcceptExSockaddrs() via a call to WSAIoctl(). Returns true if successful.
bool DisconnectEx (SOCKET s, LPOVERLAPPED pOverlapped, DWORD flags) const
 Loads, if necessary and available, and then calls DisconnectEx(). If the function isn't available then an exception is thrown.
bool LoadDisconnectEx (SOCKET s) const
 Attempts to load DisconnectEx() via a call to WSAIoctl(). Returns true if successful.
bool TransmitFile (SOCKET s, HANDLE fileToTransmit, DWORD numberOfBytesToWrite, DWORD numberOfBytesPerSend, LPOVERLAPPED lOverlapped, LPTRANSMIT_FILE_BUFFERS lTransmitBuffers, DWORD flags) const
 Loads, if necessary and available, and then calls TransmitFile(). If the function isn't available then an exception is thrown.
bool LoadTransmitFile (SOCKET s) const
 Attempts to load TransmitFile() via a call to WSAIoctl(). Returns true if successful.
bool DisconnectSocketForReuse (SOCKET s) const
 Attempts to disconnect a socket for reuse first by attempting to call DisconnectEx() and then by attempting to call TransmitFile() in 'disconnect for reuse mode' see http://msdn2.microsoft.com/en-us/library/ms740565.aspx for details. If neither option is available then an exception is thrown.
bool CanDisconnectSocketForReuse (SOCKET s) const
 Returns true if either DisconnectEx() or TransmitFile() can be a call to WSAIoctl().
int WSARecvMsg (SOCKET s, LPWSAMSG lpMsg, LPDWORD lpdwNumberOfBytesRecvd, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) const
 Loads, if necessary and available, and then calls WSARecvMsg(). If the function isn't available then an exception is thrown.
bool LoadWSARecvMsg (SOCKET s) const
 Attempts to load WSARecvMsg() via a call to WSAIoctl(). Returns true if successful.

Protected Attributes

ILimitConnections & m_connectionLimiter


Member Typedef Documentation

typedef unsigned int TCPBufferSize [inherited]


Member Enumeration Documentation

enum ZeroByteReadConfiguration [inherited]

How we perform zero byte reads, if at all.

Enumerator:
NoZeroByteRead 
ZeroByteAsyncRead 
ZeroByteSyncRead 

anonymous enum [inherited]

Enumerator:
DefaultTCPBufferSize 


Constructor & Destructor Documentation

CStreamSocketServer ( JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const bool  sslActive,
JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const bool  sslActive,
JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const bool  sslActive,
JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const bool  sslActive,
JetByteTools::SChannel::CCredentials credentials,
const bool  verifyPeer,
const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

CStreamSocketServer ( const JetByteTools::Socket::IFullAddress address,
const JetByteTools::Socket::ListenBacklog  listenBacklog,
IStreamSocketServerCallback callback,
JetByteTools::IO::IIOPool pool,
JetByteTools::Socket::IAllocateSequencedStreamSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers bufferAllocator,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize,
const ZeroByteReadConfiguration  zeroByteReadConfiguration = NoZeroByteRead,
JetByteTools::Socket::ILimitConnections connectionLimiter = JetByteTools::Socket::CConnectionLimiter::NoLimitLimiter 
)

~CStreamSocketServer (  )  [virtual]

Reimplemented from CStreamSocketServer.


Member Function Documentation

CSmartStreamSocket SecureConnect ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
)

CSmartStreamSocket SecureConnectNoThrow ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw ()

CSmartStreamSocket SecureAsyncConnect ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
)

CSmartStreamSocket SecureAsyncConnectNoThrow ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw ()

CSmartStreamSocket SecureConnectAsyncIfAvailable ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
)

CSmartStreamSocket SecureConnectAsyncIfAvailableNoThrow ( const JetByteTools::Socket::IFullAddress address,
const void *  pUserData,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw ()

bool IsSecure ( JetByteTools::Socket::IStreamSocket socket  )  const

bool RequiresPeerVerification ( JetByteTools::Socket::IStreamSocket socket  )  const

void Renegotiate ( JetByteTools::Socket::IStreamSocket socket  )  const

void Renegotiate ( JetByteTools::Socket::IStreamSocket socket,
const JetByteTools::SChannel::ClientAuthenticationRequirements  requirements 
) const

void Shutdown ( JetByteTools::Socket::IStreamSocket socket  )  const

void SendAlert ( JetByteTools::Socket::IStreamSocket socket,
const DWORD  alertType,
const DWORD  alertNumber 
) const

void SessionControl ( JetByteTools::Socket::IStreamSocket socket,
const DWORD  sessionFlags 
) const

void SetAddressDetails ( const IFullAddress address,
const ListenBacklog  listenBacklog 
) [inherited]

Set the address to listen for connections on and the size of the listen backlog queue.

void SetThreadName ( const JetByteTools::Win32::_tstring threadName  )  [inherited]

Sets the name of the accept thread as displayed in the Visual Studio debugger to the supplied name. By default the constructor sets the name of the thread to "SocketServer". Note that this must be called before calling Start() for it to have an effect.

void Start (  )  [virtual, inherited]

Implements IServerControl.

void StartAcceptingConnections (  )  [virtual, inherited]

Implements IServerControl.

void StopAcceptingConnections (  )  [virtual, inherited]

Implements IServerControl.

void InitiateShutdown (  )  [virtual, inherited]

Starts the shutdown process and returns immediately.

Implements IServerControl.

void WaitForShutdownToComplete (  )  [virtual, inherited]

Initiates a shutdown (if one isn't already in progresss) and then waits for it to complete. Does not return until the shutdown has completed.

Implements IServerControl.

bool WaitForShutdownToComplete ( const Milliseconds  timeout  )  [virtual, inherited]

Initiates a shutdown (if one isn't already in progresss) and then waits for the supplied number of milliseconds for it to complete. Returns true if the shutdown completed successfully before the timeout expired and false if it didn't.

Implements IServerControl.

void ForceShutdown (  )  [virtual, inherited]

If a shutdown is hung due to sockets still being active then you can force a shutdown to complete by calling this function. Note: USE WITH CARE!!! The usual usage pattern is to call WaitForShutdownToComplete() with a timeout and if that fails then to call ForceShutdown() to allow the object in question to be destroyed (in general the object would call WaitForShutdownToComplete() in its destructor and hang there!).

Implements IServerControl.

const IFullAddress & GetAddress (  )  const [protected, inherited]

void ReleaseSocket ( IPoolableSocket socket  )  [protected, virtual, inherited]

Used to pass the socket back to the allocator when its reference count reaches 0.

Reimplemented from CStreamSocketConnectionManager.

SOCKET CreateListeningSocket ( SOCKET  socket,
const IAddress address,
const ListenBacklog  listenBacklog 
) [protected, virtual, inherited]

Called to convert the supplied socket to a socket which is listening on the supplied address with the specified "listen backlog" (if supported). Override if the standard behaviour doesn't work for your socket type...

CSmartStreamSocket Connect ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [virtual, inherited]

CSmartStreamSocket Connect ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) [protected, inherited]

virtual CSmartStreamSocket Connect ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [pure virtual, inherited]

Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on failure to connect, the resulting stream socket is always connected and valid. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.

CSmartStreamSocket ConnectNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [virtual, inherited]

CSmartStreamSocket ConnectNoThrow ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) throw () [protected, inherited]

virtual CSmartStreamSocket ConnectNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [pure virtual, inherited]

Connects, synchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.

CSmartStreamSocket AsyncConnect ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [virtual, inherited]

CSmartStreamSocket AsyncConnect ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) [protected, inherited]

virtual CSmartStreamSocket AsyncConnect ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [pure virtual, inherited]

Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Throws exceptions on some failures to connect. The smart stream pointer is not connected until the IStreamSocketConnectionManagerCallback::OnConnectionEstablished() has been called and this may be before or after the function returns to the caller. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.

CSmartStreamSocket AsyncConnectNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [virtual, inherited]

CSmartStreamSocket AsyncConnectNoThrow ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) throw () [protected, inherited]

virtual CSmartStreamSocket AsyncConnectNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [pure virtual, inherited]

Connects, asynchronously, to the specified address and returns a smart pointer to the resulting stream socket. Does not throw exceptions, the smart stream pointer will be null if the connection attempt fails; call CSmartStreamSocket::Get() to determine this. Passes the user data pointer through to IStreamSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Sets send and recv buffer sizes before connection if values other than 0 are supplied; note that this WILL affect the TCP window size. Calls IStreamSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), either before or after returning, if the connection fails and IStreamSocketConnectionManagerCallback::OnConnectionEstablished(), either before or after returning, if the connection is successful.

CSmartStreamSocket ConnectAsyncIfAvailable ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [virtual, inherited]

CSmartStreamSocket ConnectAsyncIfAvailable ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) [protected, inherited]

virtual CSmartStreamSocket ConnectAsyncIfAvailable ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) [pure virtual, inherited]

If the platform supports asynchronous connections for this address type then acts as an AsyncConnect() else acts as a ConnectNoThrow().

CSmartStreamSocket ConnectAsyncIfAvailableNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [virtual, inherited]

CSmartStreamSocket ConnectAsyncIfAvailableNoThrow ( const IFullAddress address,
const void *  pUserData,
const void *  pFilterData,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) throw () [protected, inherited]

virtual CSmartStreamSocket ConnectAsyncIfAvailableNoThrow ( const IFullAddress address,
const void *  pUserData = 0,
const TCPBufferSize  recvBufferSize = DefaultTCPBufferSize,
const TCPBufferSize  sendBufferSize = DefaultTCPBufferSize 
) throw () [pure virtual, inherited]

If the platform supports asynchronous connections for this address type then acts as an AsyncConnectNoThrow() else acts as a ConnectNoThrow().

bool AsyncConnectAvailable ( const IAddressType addressType  )  const [virtual, inherited]

Returns true if the platform supports asynchronous connections for this address type.

Implements ICreateStreamSocketConnections.

void AbortAllConnections (  )  [virtual, inherited]

Aborts all connections that are managed by this connection manager.

Implements ICreateStreamSocketConnections.

void AddConnectionFilter ( IFilterStreamSocketConnections filter  )  [virtual, inherited]

Adds a connection filter to the connection manager. Connection filters are called in order to process calls with requests being called from "top to bottom" and completions being called from "bottom to top". For example, if filter A is added and then filter B is added and then we make a write request the data would be processed first by filter B and then by filter A (user -> B -> A -> wire). When a read completes.

(wire -> A -> B -> user).

Implements IAcceptStreamSocketConnectionFilters.

void ConnectionEstablished ( IStreamSocketEx socket,
const IAddress address 
) [protected, inherited]

void ConnectionFailed ( IStreamSocketEx socket,
const IAddress address,
const DWORD  lastError 
) [protected, inherited]

void AssociateDevice ( SOCKET  s,
JetByteTools::IO::IHandler handler 
) const [protected, inherited]

DWORD GetPoolThreadsTlsIndex (  )  const [protected, inherited]

size_t GetPoolThreadsIdentifier (  )  const [protected, inherited]

void PostIoOperation ( JetByteTools::IO::IHandler handler,
JetByteTools::IO::IBuffer buffer,
const JetByteTools::IO::IBuffer::Operation  operation,
const bool  forceDispatchToPool = true 
) [protected, inherited]

void HandleOperation ( IStreamSocketEx socket,
JetByteTools::IO::IBuffer buffer,
const DWORD  ioSize,
const DWORD  lastError 
) [protected, virtual, inherited]

Handles an I/O operation.

Implements IStreamSocketConnectionManager.

void RequestRead ( IStreamSocketEx socket,
JetByteTools::IO::IBuffer pBuffer 
) [protected, virtual, inherited]

Called by a socket to have the manager shedule a read operation to occur on one of the I/O threads.

Implements IStreamSocketConnectionManager.

void RequestWrite ( IStreamSocketEx socket,
JetByteTools::IO::IBuffer buffer 
) [protected, virtual, inherited]

Called by a socket to have the manager shedule a write operation to occur on one of the I/O threads.

Implements IStreamSocketConnectionManager.

void ExecuteWrite ( IStreamSocketEx socket,
JetByteTools::IO::IBuffer buffer 
) [protected, virtual, inherited]

Called by a socket to have the manager actually perform a write operation. The socket controls this action as it may be responsible for sequencing buffers into the correct order before issuing the writes.

Implements IStreamSocketConnectionManager.

IBuffer * AllocateBuffer (  )  [protected, virtual, inherited]

Allows the socket to access the buffer allocator that is being used by the manager so that it can generate write calls using the correct buffers. These write calls are the result of the non buffer based Write() and TryWrite() methods being called.

Implements IStreamSocketConnectionManager.

void OnClientClose ( IStreamSocketEx socket  )  [protected, virtual, inherited]

Called by the socket when a OnConnectionClientClose event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.

Implements IStreamSocketConnectionManager.

void OnConnectionReset ( IStreamSocketEx socket,
const DWORD  lastError 
) [protected, virtual, inherited]

Called by the socket when a OnConnectionConnectionReset event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.

Implements IStreamSocketConnectionManager.

void OnConnectionClosed ( IStreamSocketEx socket  )  [protected, virtual, inherited]

Called by the socket when a OnConnectionClosed event is detected. Allows the manager to dispatch the event to the thread pool so that it occurs when the socket is not holding its internal lock.

Implements IStreamSocketConnectionManager.

CSmartStreamSocketEx AllocateSocket ( SOCKET  theSocket  )  [protected, inherited]

SOCKET CreateSocket ( const IAddressType addressType,
const TCPBufferSize  recvBufferSize,
const TCPBufferSize  sendBufferSize 
) const [protected, inherited]

void SetBufferSize ( SOCKET  s,
const TCPBufferSize  bufferSize,
const int  optionName 
) const [protected, inherited]

bool ConnectEx ( SOCKET  s,
const struct sockaddr FAR *  name,
int  namelen,
PVOID  lpSendBuffer,
DWORD  dwSendDataLength,
LPDWORD  lpdwBytesSent,
LPOVERLAPPED  lpOverlapped 
) const [inherited]

Loads, if necessary and available, and then calls ConnectEx(). If the function isn't available then an exception is thrown.

bool LoadConnectEx ( SOCKET  s  )  const [inherited]

Attempts to load ConnectEx() via a call to WSAIoctl(). Returns true if successful.

bool AcceptEx ( SOCKET  listenSocket,
SOCKET  acceptSocket,
PVOID  pOutputBuffer,
DWORD  receiveDataLength,
DWORD  localAddressLength,
DWORD  remoteAddressLength,
LPDWORD  bytesReceived,
LPOVERLAPPED  pOverlapped 
) const [inherited]

Loads, if necessary and available, and then calls AcceptEx(). If the function isn't available then an exception is thrown.

bool LoadAcceptEx ( SOCKET  s  )  const [inherited]

Attempts to load AcceptEx() via a call to WSAIoctl(). Returns true if successful.

void GetAcceptExSockaddrs ( PVOID  pOutputBuffer,
DWORD  receiveDataLength,
DWORD  localAddressLength,
DWORD  remoteAddressLength,
LPSOCKADDR *  pLocalSockaddr,
LPINT  pLocalSockaddrLength,
LPSOCKADDR *  pRemoteSockaddr,
LPINT  pRemoteSockaddrLength 
) const [inherited]

Loads, if necessary and available, and then calls GetAcceptExSockaddrs(). If the function isn't available then an exception is thrown.

bool LoadGetAcceptExSockaddrs ( SOCKET  s  )  const [inherited]

Attempts to load GetAcceptExSockaddrs() via a call to WSAIoctl(). Returns true if successful.

bool DisconnectEx ( SOCKET  s,
LPOVERLAPPED  pOverlapped,
DWORD  flags 
) const [inherited]

Loads, if necessary and available, and then calls DisconnectEx(). If the function isn't available then an exception is thrown.

bool LoadDisconnectEx ( SOCKET  s  )  const [inherited]

Attempts to load DisconnectEx() via a call to WSAIoctl(). Returns true if successful.

bool TransmitFile ( SOCKET  s,
HANDLE  fileToTransmit,
DWORD  numberOfBytesToWrite,
DWORD  numberOfBytesPerSend,
LPOVERLAPPED  lOverlapped,
LPTRANSMIT_FILE_BUFFERS  lTransmitBuffers,
DWORD  flags 
) const [inherited]

Loads, if necessary and available, and then calls TransmitFile(). If the function isn't available then an exception is thrown.

bool LoadTransmitFile ( SOCKET  s  )  const [inherited]

Attempts to load TransmitFile() via a call to WSAIoctl(). Returns true if successful.

bool DisconnectSocketForReuse ( SOCKET  s  )  const [inherited]

Attempts to disconnect a socket for reuse first by attempting to call DisconnectEx() and then by attempting to call TransmitFile() in 'disconnect for reuse mode' see http://msdn2.microsoft.com/en-us/library/ms740565.aspx for details. If neither option is available then an exception is thrown.

bool CanDisconnectSocketForReuse ( SOCKET  s  )  const [inherited]

Returns true if either DisconnectEx() or TransmitFile() can be a call to WSAIoctl().

int WSARecvMsg ( SOCKET  s,
LPWSAMSG  lpMsg,
LPDWORD  lpdwNumberOfBytesRecvd,
LPWSAOVERLAPPED  lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
) const [inherited]

Loads, if necessary and available, and then calls WSARecvMsg(). If the function isn't available then an exception is thrown.

bool LoadWSARecvMsg ( SOCKET  s  )  const [inherited]

Attempts to load WSARecvMsg() via a call to WSAIoctl(). Returns true if successful.


Member Data Documentation

ILimitConnections& m_connectionLimiter [protected, inherited]


Generated on Thu Mar 26 16:39:46 2009 for JetByte Socket Tools - v6.0 by  doxygen 1.5.3