CDatagramSocketConnectionManager Class Reference
[Datagram SocketsConnection managers]

Inheritance diagram for CDatagramSocketConnectionManager:

Inheritance graph
[legend]
Collaboration diagram for CDatagramSocketConnectionManager:

Collaboration graph
[legend]

List of all members.


Detailed Description

A connection manager for datagram sockets.

Public Types

typedef unsigned long DataLength

Public Member Functions

 CDatagramSocketConnectionManager (IDatagramSocketConnectionManagerCallback &callback, JetByteTools::IO::IIOPool &pool, IAllocateDatagramSockets &socketAllocator, JetByteTools::IO::IAllocateBuffers &allocator)
 Construct a connection manager with the supplied callback interface, I/O pool, and allocators.
virtual ~CDatagramSocketConnectionManager ()
CSmartDatagramSocket Bind (const IFullAddress &address)
 Creates a datagram socket and binds it to the supplied address.
CSmartDatagramSocket SendTo (const IFullAddress &address, const char *pData, const DataLength dataLength)
 Creates a datagram socket and issues a SendTo() of the data to the supplied address.
CSmartDatagramSocket SendTo (const IFullAddress &address, const BYTE *pData, const DataLength dataLength)
 Creates a datagram socket and issues a SendTo() of the data to the supplied address.
CSmartDatagramSocket SendTo (const IFullAddress &address, JetByteTools::IO::IBuffer &buffer)
 Creates a datagram socket and issues a SendTo() of the data to the supplied address.
CSmartDatagramSocket Connect (const IFullAddress &address, const void *pUserData=0)
 Connects, synchronously, to the specified address and returns a smart pointer to the resulting datagram socket. Throws exceptions on failure to connect, the resulting datagram socket is always connected and valid. Passes the user data pointer through to IDatagramSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IDatagramSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
CSmartDatagramSocket ConnectNoThrow (const IFullAddress &address, const void *pUserData=0) throw ()
 Connects, synchronously, to the specified address and returns a smart pointer to the resulting datagram socket. Does not throw exceptions, the smart datagram pointer will be null if the connection attempt fails; call CSmartDatagramSocket::Get() to determine this. Passes the user data pointer through to IDatagramSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IDatagramSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IDatagramSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.
void AbortAllConnections ()
 Aborts all connections that are managed by this connection manager.
void InitiateShutdown ()
 Starts the shutdown process and returns immediately.
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.

Protected Member Functions

SOCKET CreateSocket (const IAddressType &addressType)
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(), etc methods being called.
virtual void OnConnectionReset (IDatagramSocketEx &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 ReleaseSocket (IPoolableSocket &socket)
 Used to pass the socket back to the allocator when its reference count reaches 0.
virtual void RequestRead (IDatagramSocketEx &socket, JetByteTools::IO::IBuffer *pBuffer)
virtual void RequestRecvFrom (IDatagramSocketEx &socket, JetByteTools::IO::IBuffer *pBuffer)
virtual void RequestWrite (IDatagramSocketEx &socket, JetByteTools::IO::IBuffer &buffer)
virtual void RequestSendTo (IDatagramSocketEx &socket, const IAddress &address, JetByteTools::IO::IBuffer &buffer)
virtual
CSmartDatagramSocketEx 
AllocateSocket (SOCKET theSocket)
virtual void HandleOperation (IDatagramSocketEx &socket, JetByteTools::IO::IBuffer &buffer, const DWORD ioSize, const DWORD lastError)
 Handles an I/O operation.

Member Typedef Documentation

typedef unsigned long DataLength [inherited]


Constructor & Destructor Documentation

CDatagramSocketConnectionManager ( IDatagramSocketConnectionManagerCallback callback,
JetByteTools::IO::IIOPool pool,
IAllocateDatagramSockets socketAllocator,
JetByteTools::IO::IAllocateBuffers allocator 
)

Construct a connection manager with the supplied callback interface, I/O pool, and allocators.

~CDatagramSocketConnectionManager (  )  [virtual]


Member Function Documentation

CSmartDatagramSocket Bind ( const IFullAddress address  ) 

Creates a datagram socket and binds it to the supplied address.

CSmartDatagramSocket SendTo ( const IFullAddress address,
const char *  pData,
const DataLength  dataLength 
)

Creates a datagram socket and issues a SendTo() of the data to the supplied address.

CSmartDatagramSocket SendTo ( const IFullAddress address,
const BYTE *  pData,
const DataLength  dataLength 
)

Creates a datagram socket and issues a SendTo() of the data to the supplied address.

CSmartDatagramSocket SendTo ( const IFullAddress address,
JetByteTools::IO::IBuffer buffer 
)

Creates a datagram socket and issues a SendTo() of the data to the supplied address.

CSmartDatagramSocket Connect ( const IFullAddress address,
const void *  pUserData = 0 
)

Connects, synchronously, to the specified address and returns a smart pointer to the resulting datagram socket. Throws exceptions on failure to connect, the resulting datagram socket is always connected and valid. Passes the user data pointer through to IDatagramSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IDatagramSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.

CSmartDatagramSocket ConnectNoThrow ( const IFullAddress address,
const void *  pUserData = 0 
) throw ()

Connects, synchronously, to the specified address and returns a smart pointer to the resulting datagram socket. Does not throw exceptions, the smart datagram pointer will be null if the connection attempt fails; call CSmartDatagramSocket::Get() to determine this. Passes the user data pointer through to IDatagramSocketConnectionManagerCallback::OnPreOutgoingConnect() before returning. Calls IDatagramSocketConnectionManagerCallback::OnOutgoingConnectionFailed(), before returning, if the connection fails and IDatagramSocketConnectionManagerCallback::OnConnectionEstablished(), before returning, if the connection is successful.

void AbortAllConnections (  ) 

Aborts all connections that are managed by this connection manager.

void InitiateShutdown (  ) 

Starts the shutdown process and returns immediately.

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.

SOCKET CreateSocket ( const IAddressType addressType  )  [protected]

IBuffer * AllocateBuffer (  )  [protected, virtual]

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(), etc methods being called.

Implements IDatagramSocketConnectionManager.

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

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 IDatagramSocketConnectionManager.

void ReleaseSocket ( IPoolableSocket socket  )  [protected, virtual]

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

Implements IDatagramSocketConnectionManager.

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

Implements IDatagramSocketConnectionManager.

void RequestRecvFrom ( IDatagramSocketEx socket,
JetByteTools::IO::IBuffer pBuffer 
) [protected, virtual]

Implements IDatagramSocketConnectionManager.

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

Implements IDatagramSocketConnectionManager.

void RequestSendTo ( IDatagramSocketEx socket,
const IAddress address,
JetByteTools::IO::IBuffer buffer 
) [protected, virtual]

Implements IDatagramSocketConnectionManager.

CSmartDatagramSocketEx AllocateSocket ( SOCKET  theSocket  )  [protected, virtual]

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

Handles an I/O operation.

Implements IDatagramSocketConnectionManager.


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