Serial Framework C++ Edition
Public Member Functions | Protected Member Functions | List of all members
CwclServerDataConnection Class Reference

The base class for the server connection that requires data exchange with a remote device. More...

#include <wclConnections.h>

Inheritance diagram for CwclServerDataConnection:
CwclServerConnection CwclCustomConnection

Public Member Functions

 CwclServerDataConnection ()
 Creates a new client data connection.
 
__event void OnData (void *Sender, CwclServerClientDataConnection *const Client, const void *const Data, const unsigned long Size)
 The event fires when new data is received from the connected remote device.
 
- Public Member Functions inherited from CwclServerConnection
 CwclServerConnection ()
 Creates a new server connection.
 
virtual ~CwclServerConnection ()
 Frees the server connection.
 
int Close ()
 The method disconnects all connected clients and closes the server.
 
int Listen ()
 The method starts listening for client connections.
 
CwclServerClientConnectionGetClients (const size_t Index) const
 Gets a connected client by its index.
 
 __declspec (property(get=GetClients)) CwclServerClientConnection *Clients[]
 Gets a connected client by its index.
 
size_t GetClientsCount () const
 Gets the number of connected clients.
 
 __declspec (property(get=GetClientsCount)) size_t ClientsCount
 Gets the number of connected clients.
 
wclServerState GetState () const
 Gets the connection state.
 
 __declspec (property(get=GetState)) wclServerState State
 Gets the connection state.
 
__event void OnClosed (void *Sender, const int Reason)
 The event fires when the server is closed.
 
__event void OnConnect (void *Sender, CwclServerClientConnection *const Client, const int Error)
 The event fires when a remote client is connected to the server.
 
__event void OnDisconnect (void *Sender, CwclServerClientConnection *const Client, const int Reason)
 The event fires when a remote client has disconnected from the server.
 
__event void OnListen (void *Sender)
 The event fires when the server is ready to accept incoming connections (is in listening state).
 
- Public Member Functions inherited from CwclCustomConnection
 CwclCustomConnection ()
 Creates a new connection.
 
virtual ~CwclCustomConnection ()
 Frees the connection.
 
CwclMessageReceiverGetReceiver () const
 Gets the connection message receiver object.
 
 __declspec (property(get=GetReceiver)) CwclMessageReceiver *Receiver
 Gets the connection message receiver object.
 
DWORD GetThreadId () const
 Gets the connection's thread ID.
 
 __declspec (property(get=GetThreadId)) DWORD ThreadId
 Gets the connection's thread ID.
 

Protected Member Functions

virtual void UnhookDeletedClientEvents (CwclServerClientConnection *const Client) override
 Unhooks events from the client that should be deleted.
 
virtual void SetClientEvents (CwclServerClientConnection *const Client) override
 The method sets the client's event handlers.
 
virtual void DoData (CwclServerClientDataConnection *const Client, const void *const Data, const unsigned long Size)
 Fires the OnData event.
 
- Protected Member Functions inherited from CwclServerConnection
virtual void UnhookDeletedClientEvents (CwclServerClientConnection *const Client)
 Unhooks events from the client that should be deleted.
 
void InternalClose (const int Reason)
 Closes the server.
 
int CreateNewClientConnection (const void *const Params, const unsigned long ParamsSize)
 Sends a notification to the main thread to create and init new client connection.
 
virtual void MessageReceived (const CwclMessage *const Message) override
 The message receiver calls this method when a new notification message has been received.
 
virtual void DoClosed (const int Reason)
 Fires the OnClosed event.
 
virtual void DoConnect (CwclServerClientConnection *const Client, const int Error)
 Fires the OnConnect event.
 
virtual void DoDisconnect (CwclServerClientConnection *const Client, const int Reason)
 Fires the OnDisconnect event.
 
virtual void DoListen ()
 Fires the OnListen event.
 
virtual void SetClientEvents (CwclServerClientConnection *const Client)
 The method sets the client's event handlers.
 
virtual int HalListen (const HANDLE Event)=0
 Implements a hardware-dependent method for listening the client connections.
 
virtual int HalClose ()=0
 Implements a hardware-dependent method to stop listening.
 
virtual CwclServerClientConnectionHalCreateClient ()=0
 The method creates a hardware and transport-dependent client connection.
 
virtual int HalPrepare ()=0
 Implements a hardware-dependent code that prepares for listening.
 
- Protected Member Functions inherited from CwclCustomConnection
virtual void MessageReceived (const CwclMessage *const Message)
 The message receiver calls this method when a new notification message has been received.
 
void Enter ()
 Enters the connection's critical section.
 
void Leave ()
 Exists *leaves) the connection's critical section.
 

Detailed Description

The base class for the server connection that requires data exchange with a remote device.

See also
CwclServerConnection