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

CConnectionMaintainingStreamSocketConnectionFilter Class Reference
[Filtering]

Inheritance diagram for CConnectionMaintainingStreamSocketConnectionFilter:
Collaboration diagram for CConnectionMaintainingStreamSocketConnectionFilter:

List of all members.


Detailed Description

A connection filter that will attempt to reconnect connections that are terminated after a configurable timeout. You can indicate that you want a connection to be maintained by calling MaintainConnections() and you can allow the connection to close and stay closed by calling CancelConnectionRetries().


Public Member Functions

 CConnectionMaintainingStreamSocketConnectionFilter (IAcceptStreamSocketConnectionFilters &filterManager, ICreateStreamSocketConnections &connectionCreator, JetByteTools::Core::IQueueTimers &timerQueue, JetByteTools::Milliseconds reconnectAfter)
 Installs the connection filter on all connections made by the supplied connection manager.
 CConnectionMaintainingStreamSocketConnectionFilter (const CConnectionMaintainingStreamSocketConnectionFilter &rhs)
 ~CConnectionMaintainingStreamSocketConnectionFilter ()
CConnectionMaintainingStreamSocketConnectionFilteroperator= (const CConnectionMaintainingStreamSocketConnectionFilter &rhs)
void MaintainConnections (const IFullAddress &address, Milliseconds reconnectTimeout, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 Sets the connection retry timeout for connections to the supplied address to the supplied value.
bool TryCancelConnectionRetries (const IAddress &address, bool shutDownExistingConnections=false) override
 Attempts to cancel connection reties attempts to the supplied address. Returns false if the connection wasn't currently being maintained.
void CancelConnectionRetries (const IAddress &address, bool shutDownExistingConnections=false) override
 Cancels connection reties attempts to the supplied address.
void CancelAllConnectionRetries () override
 Cancels connection reties for all connections that are maintained by this connection manager.
CSmartStreamSocket Connect (const IFullAddress &address, const void *pUserData=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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=nullptr, SocketBufferSize recvBufferSize=DefaultSocketBufferSize, SocketBufferSize sendBufferSize=DefaultSocketBufferSize) override
 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 override
 Returns true if the platform supports asynchronous connections for this address type.
DWORD AbortAllConnections () override
 Aborts all connections that are managed by this connection manager.


Constructor & Destructor Documentation

Installs the connection filter on all connections made by the supplied connection manager.


Member Function Documentation

void MaintainConnections ( const IFullAddress address,
Milliseconds  reconnectTimeout,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

Sets the connection retry timeout for connections to the supplied address to the supplied value.

Implements IMaintainStreamSocketConnections.

bool TryCancelConnectionRetries ( const IAddress address,
bool  shutDownExistingConnections = false 
) [override, virtual]

Attempts to cancel connection reties attempts to the supplied address. Returns false if the connection wasn't currently being maintained.

Implements IMaintainStreamSocketConnections.

void CancelConnectionRetries ( const IAddress address,
bool  shutDownExistingConnections = false 
) [override, virtual]

Cancels connection reties attempts to the supplied address.

Implements IMaintainStreamSocketConnections.

void CancelAllConnectionRetries (  )  [override, virtual]

Cancels connection reties for all connections that are maintained by this connection manager.

Implements IMaintainStreamSocketConnections.

CSmartStreamSocket Connect ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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.

Implements ICreateStreamSocketConnections.

CSmartStreamSocket ConnectNoThrow ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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.

Implements ICreateStreamSocketConnections.

CSmartStreamSocket AsyncConnect ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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.

Implements ICreateStreamSocketConnections.

CSmartStreamSocket AsyncConnectNoThrow ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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.

Implements ICreateStreamSocketConnections.

CSmartStreamSocket ConnectAsyncIfAvailable ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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

Implements ICreateStreamSocketConnections.

CSmartStreamSocket ConnectAsyncIfAvailableNoThrow ( const IFullAddress address,
const void *  pUserData = nullptr,
SocketBufferSize  recvBufferSize = DefaultSocketBufferSize,
SocketBufferSize  sendBufferSize = DefaultSocketBufferSize 
) [override, virtual]

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

Implements ICreateStreamSocketConnections.

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

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

Implements ICreateStreamSocketConnections.

DWORD AbortAllConnections (  )  [override, virtual]

Aborts all connections that are managed by this connection manager.

Implements ICreateStreamSocketConnections.


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