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

IStreamSocketConnectionManagerCallback Class Reference

Inheritance diagram for IStreamSocketConnectionManagerCallback:
Collaboration diagram for IStreamSocketConnectionManagerCallback:

List of all members.

Public Member Functions

virtual void OnSocketCreated (SOCKET s)=0
 Called just after a socket is created. Allows you to adjust socket options that aren't othewise accessible via the framework. Use with care.
virtual void OnPreOutgoingConnect (JetByteTools::Core::IIndexedOpaqueUserData &userData, const IAddress &address, const void *pUserData)=0
 Called just before an outgoing connection is established, i.e. a 'client' connection. The userData is the user data associated with the socket that will attempt the connection. The address is the address that the socket will attempt to connect to and the pointer to user data is whatever was passed in as user data to the Connect(), ConnectNoThrow(), AsyncConnect() or AsyncConnectNoThrow() call. This is usually used to slot the pointer to user data into the socket's user data store before the connection is attempted; thus passing data from the connect call site to the connection establishment or failure callback and beyond.
virtual void OnConnectionEstablished (IStreamSocket &socket, const IAddress &address)=0
 Called when a connection is established. The address is the address that the socket is connected to. This is where you are expected to issue your first Read() or Write() call on a connection, if you don't and don't increase the reference count of the socket in some other way then the socket will close automatically.
virtual void OnOutgoingConnectionFailed (IStreamSocket &socket, const IAddress &address, DWORD lastError)=0
 Called when an outgoing async or sync no throw connection fails. The address is the address that we were attempting to connect to. Note that sync connections attempts that can throw exceptions do not result in this callback being called when they fail to connect.
virtual void OnSocketReleased (JetByteTools::Core::IIndexedOpaqueUserData &userData)=0
 Called when a connection is released back to the allocator. This is guarenteed to be the last event that happens on an active socket. The socket is dead at this point and you're passed the userData that was related to it so that you can perform some final cleanup if required. Note that you should not assume that you can use the address of the user data object for anything. Due to how the socket object's inheritance works this particular interface is different to the instance of IIndexedOpaqueUserData that you can cast to from the IStreamSocket interface that you're given in all of the other callbacks and the address of this user data will be different to the address of the user data passed in OnPreOutgoingConnect() for the same socket. Note that you can, of course, access the socket's user data store via the interface, you just can't use the address of the interface for anything useful.
virtual void OnReadCompleted (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0
 Called when an asynchronous read completes. This is where you are given the data that has been received on the connection and where your business logic would usually be expected to start dealing with the data. You are generally expected to issue another Read() before this call completes, if you don't and don't increase the reference count of the socket in some other way then the socket will close automatically.
virtual bool OnReadCompletionErrorMayNotBeFatalConnectionError (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, const DWORD lastError)
 Called when an asynchronous read completes with an error. Override this version if you want to be able to continue the connection if a read error occurs, otherwise connections are aborted on any read error.
virtual void OnReadCompletionError (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError)=0
 Called when an asynchronous read completes with an error.
virtual void OnReadOOBCompleted (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0
 Called when an asynchronous out of band data read completes.
virtual void OnWriteCompleted (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer)=0
 Called when an asynchronous write completes. There's not a great deal that needs to be done here. Note that this is called when the data in your buffer has been handed off to the local TCP stack to send, it does not, in any way, imply any more than that. See here for more details.
virtual bool OnWriteCompletionErrorMayNotBeFatalConnectionError (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, const DWORD lastError)
 Called when an asynchronous write completes with an error. In certain low resource situations you may find that the write can complete and not all of the data has been sent, but there's probably not a great deal that you can do to fix things... Override this version if you want to be able to continue the connection if a write error occurs, otherwise connections are aborted on any write error.
virtual void OnWriteCompletionError (IStreamSocket &socket, JetByteTools::IO::CSmartBuffer &buffer, DWORD lastError)=0
 Called when an asynchronous write completes with an error. In certain low resource situations you may find that the write can complete and not all of the data has been sent, but there's probably not a great deal that you can do to fix things...
virtual void OnMaximumConnections ()=0
 Called when the maximum allowed number of connections is reached and no more new connections will be accepted by the server. See ILimitConnections for details on limiting connections.
virtual void OnAllConnectionsAborted (DWORD numberOfConnectionsAborted)=0
 Called when connections have been aborted due to AbortAllConnections() being called either explicitly, or implicitly as part of a shutdown sequence.
virtual void OnShutdownInitiated ()=0
 Called when the connection manager starts to shutdown.
virtual void OnShutdownComplete ()=0
 Called when the connection manager has finished its shutdown process and all active connections have been released.
virtual void OnConnectionClientClose (IStreamSocket &socket)=0
 Called when the 'read side' of the connection is closed by the remote end. The remote end of the connection can no longer send data to you as it has issued a shutdown() call and shut down at least the write side of its socket. This means that you can no longer read from the connection but you may still be able to write to the connection.
virtual void OnConnectionReset (IStreamSocket &socket, DWORD lastError)=0
 Called when the connection is reset.
virtual void OnConnectionClosure (IStreamSocket &socket, ConnectionClosureReason reason)=0
 Called when the connection is closed.
virtual void OnConnectionClosed (IStreamSocket &socket)=0
 Called when the connection is closed. Note that this callback is purely for backwards compatibility with pre v6.2 code. You will get both an OnConnectionClosure() callback with a closure reason and then an OnConnectionClosed() without a reason. OnConnectionClosed() MAY be removed in a future release of the framework.
virtual void OnError (const JetByteTools::Core::_tstring &message)=0
 Called when there is an error which is not related to a particular connection (such as an exception thrown whilst handling an I/O operation or something...). Not a lot you can do except log the error message... Possibly shouldn't be exposed to client code?
virtual void OnError (const JetByteTools::Core::_tstring &message, DWORD lastError)=0
virtual void OnSecureConnectionEstablished (JetByteTools::Socket::IStreamSocket &socket, const JetByteTools::Socket::IAddress &address)=0
 Called when a secure connection is established, i.e. a connection that is protected by SSL. This is called before the OnConnectionEstablished() is called and is intended to allow the user to do specific connection establishment operations that are only required for secure connections. The address is the address that the socket is connected to.
virtual void OnSecureSocketReleased (JetByteTools::Core::IIndexedOpaqueUserData &userData)=0
 Called when a secure connection is released back to the allocator. This is called after OnSocketReleased() and is intended to allow you to clean up any user data that you might need to clean up for secure connections.
virtual void OnFatalError (JetByteTools::Socket::IStreamSocket &socket, SECURITY_STATUS status)=0
 Called when there is a fatal error during security processing, such as a failure to negotiate or decrypt. The connection will be shutdown after this call completes.
virtual void OnRemoteFatalError (JetByteTools::Socket::IStreamSocket &socket, SECURITY_STATUS status)=0
virtual void OnNegotiationComplete (JetByteTools::Socket::IStreamSocket &socket, const IClientContext &context)=0
 Called to notify you of an outbound connection's attributes.
virtual void OnNegotiationComplete (JetByteTools::Socket::IStreamSocket &socket, const IServerContext &context)=0
 Called to notify you of an inbound connection's attributes.

Protected Member Functions

virtual ~IStreamSocketConnectionManagerCallback ()
 We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Constructor & Destructor Documentation

virtual ~IStreamSocketConnectionManagerCallback (  )  [protected, virtual]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.

Reimplemented from IStreamSocketConnectionManagerCallback.


Member Function Documentation

virtual void OnPreOutgoingConnect ( JetByteTools::Core::IIndexedOpaqueUserData userData,
const IAddress address,
const void *  pUserData 
) [pure virtual, inherited]

Called just before an outgoing connection is established, i.e. a 'client' connection. The userData is the user data associated with the socket that will attempt the connection. The address is the address that the socket will attempt to connect to and the pointer to user data is whatever was passed in as user data to the Connect(), ConnectNoThrow(), AsyncConnect() or AsyncConnectNoThrow() call. This is usually used to slot the pointer to user data into the socket's user data store before the connection is attempted; thus passing data from the connect call site to the connection establishment or failure callback and beyond.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnConnectionEstablished ( IStreamSocket socket,
const IAddress address 
) [pure virtual, inherited]

Called when a connection is established. The address is the address that the socket is connected to. This is where you are expected to issue your first Read() or Write() call on a connection, if you don't and don't increase the reference count of the socket in some other way then the socket will close automatically.

Implemented in CHTTPSocketServer, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnOutgoingConnectionFailed ( IStreamSocket socket,
const IAddress address,
DWORD  lastError 
) [pure virtual, inherited]

Called when an outgoing async or sync no throw connection fails. The address is the address that we were attempting to connect to. Note that sync connections attempts that can throw exceptions do not result in this callback being called when they fail to connect.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnSocketReleased ( JetByteTools::Core::IIndexedOpaqueUserData userData  )  [pure virtual, inherited]

Called when a connection is released back to the allocator. This is guarenteed to be the last event that happens on an active socket. The socket is dead at this point and you're passed the userData that was related to it so that you can perform some final cleanup if required. Note that you should not assume that you can use the address of the user data object for anything. Due to how the socket object's inheritance works this particular interface is different to the instance of IIndexedOpaqueUserData that you can cast to from the IStreamSocket interface that you're given in all of the other callbacks and the address of this user data will be different to the address of the user data passed in OnPreOutgoingConnect() for the same socket. Note that you can, of course, access the socket's user data store via the interface, you just can't use the address of the interface for anything useful.

Implemented in CHTTPSocketServer, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnReadCompleted ( IStreamSocket socket,
JetByteTools::IO::CSmartBuffer buffer 
) [pure virtual, inherited]

Called when an asynchronous read completes. This is where you are given the data that has been received on the connection and where your business logic would usually be expected to start dealing with the data. You are generally expected to issue another Read() before this call completes, if you don't and don't increase the reference count of the socket in some other way then the socket will close automatically.

Implemented in CHTTPSocketServer, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual bool OnReadCompletionErrorMayNotBeFatalConnectionError ( IStreamSocket socket,
JetByteTools::IO::CSmartBuffer buffer,
const DWORD  lastError 
) [inline, virtual, inherited]

Called when an asynchronous read completes with an error. Override this version if you want to be able to continue the connection if a read error occurs, otherwise connections are aborted on any read error.

virtual void OnWriteCompleted ( IStreamSocket socket,
JetByteTools::IO::CSmartBuffer buffer 
) [pure virtual, inherited]

Called when an asynchronous write completes. There's not a great deal that needs to be done here. Note that this is called when the data in your buffer has been handed off to the local TCP stack to send, it does not, in any way, imply any more than that. See here for more details.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual bool OnWriteCompletionErrorMayNotBeFatalConnectionError ( IStreamSocket socket,
JetByteTools::IO::CSmartBuffer buffer,
const DWORD  lastError 
) [inline, virtual, inherited]

Called when an asynchronous write completes with an error. In certain low resource situations you may find that the write can complete and not all of the data has been sent, but there's probably not a great deal that you can do to fix things... Override this version if you want to be able to continue the connection if a write error occurs, otherwise connections are aborted on any write error.

virtual void OnWriteCompletionError ( IStreamSocket socket,
JetByteTools::IO::CSmartBuffer buffer,
DWORD  lastError 
) [pure virtual, inherited]

Called when an asynchronous write completes with an error. In certain low resource situations you may find that the write can complete and not all of the data has been sent, but there's probably not a great deal that you can do to fix things...

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnAllConnectionsAborted ( DWORD  numberOfConnectionsAborted  )  [pure virtual, inherited]

virtual void OnConnectionClientClose ( IStreamSocket socket  )  [pure virtual, inherited]

Called when the 'read side' of the connection is closed by the remote end. The remote end of the connection can no longer send data to you as it has issued a shutdown() call and shut down at least the write side of its socket. This means that you can no longer read from the connection but you may still be able to write to the connection.

Implemented in CHTTPSocketServer, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, CStreamSocketServerExCallback, and CStreamSocketServerExCallback.

virtual void OnConnectionClosed ( IStreamSocket socket  )  [pure virtual, inherited]

virtual void OnError ( const JetByteTools::Core::_tstring message  )  [pure virtual, inherited]

virtual void OnSecureConnectionEstablished ( JetByteTools::Socket::IStreamSocket socket,
const JetByteTools::Socket::IAddress address 
) [pure virtual, inherited]

Called when a secure connection is established, i.e. a connection that is protected by SSL. This is called before the OnConnectionEstablished() is called and is intended to allow the user to do specific connection establishment operations that are only required for secure connections. The address is the address that the socket is connected to.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, and CStreamSocketServerExCallback.

virtual void OnSecureSocketReleased ( JetByteTools::Core::IIndexedOpaqueUserData userData  )  [pure virtual, inherited]

Called when a secure connection is released back to the allocator. This is called after OnSocketReleased() and is intended to allow you to clean up any user data that you might need to clean up for secure connections.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, and CStreamSocketServerExCallback.

virtual void OnFatalError ( JetByteTools::Socket::IStreamSocket socket,
SECURITY_STATUS  status 
) [pure virtual, inherited]

Called when there is a fatal error during security processing, such as a failure to negotiate or decrypt. The connection will be shutdown after this call completes.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, and CStreamSocketServerExCallback.

virtual void OnRemoteFatalError ( JetByteTools::Socket::IStreamSocket socket,
SECURITY_STATUS  status 
) [pure virtual, inherited]

virtual void OnNegotiationComplete ( JetByteTools::Socket::IStreamSocket socket,
const IClientContext context 
) [pure virtual, inherited]

Called to notify you of an outbound connection's attributes.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, and CStreamSocketServerExCallback.

virtual void OnNegotiationComplete ( JetByteTools::Socket::IStreamSocket socket,
const IServerContext context 
) [pure virtual, inherited]

Called to notify you of an inbound connection's attributes.

Implemented in CStreamSocketConnectionManagerCallback, CStreamSocketServerCallback, and CStreamSocketServerExCallback.


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