GlobalObjects
Loading...
Searching...
No Matches
glo::Server Class Reference

The server that communicates with Client's More...

#include <GloServer.h>

Inheritance diagram for glo::Server:

Classes

class  TcpServerReceiverTransmitter
 A special ServerReceiverTransmitter for the Server. Its ServerReceiver is of the derived type TcpServerReceiver and this can send orders. More...
 

Public Member Functions

 Server (const std::string &rsSchemaPath, const std::vector< std::string > &rKnownSchemesVector, unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, unsigned int uiDataSize, unsigned long ulMaxClients, int iSecTimeOut)
 
virtual ~Server ()
 
virtual void cancel () override
 
virtual tcp::Server::ServerReceiverTransmittergenerateNewServerReceiverTransmitter (tcp::Server *pParent, SOCKET nSocket, unsigned int uiDataSize) const override
 
void getAllClients (std::vector< ClientInfo > &rClientInfoVector) const
 
void getAllKnownBases (std::vector< std::string > &rKnownBasesVector) const
 
std::string getSchemaPath () const
 
ShowLevel getShowLevel ()
 
virtual void insertNewClient (Server::ServerReceiverTransmitter *pNewServerReceiverTransmitter) override
 
virtual void processClientMessage (tcp::AbstractMessage *pTcpMessage) override
 
virtual int removeClient (SOCKET nSocket) override
 
void setActionVisualiser (ManagerActionVisualiser *pActionVisualiser)
 
void setShowLevel (ShowLevel ulLevel)
 
- Public Member Functions inherited from tcp::Server
 Server (unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, unsigned int uiDataSize, unsigned long ulMaxClients, int iSecTimeOut)
 
int acceptClientMessage (AbstractMessage *pTcpMessage)
 
- Public Member Functions inherited from tcp::TcpMain
 TcpMain (unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, int iSecTimeOut)
 
 TcpMain (unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, unsigned int uiDataSize, int iSecTimeOut)
 
virtual ~TcpMain ()
 
unsigned int getDataSize () const
 
SOCKET getMainSocket () const
 
unsigned int getPortNum () const
 
virtual void setDataSize (unsigned int uiDataSize)
 
void setTimeOutSec (int iSecTimeOut)
 
int TimeOutSec ()
 
- Public Member Functions inherited from eut::RepeatingThread
 RepeatingThread ()
 
virtual ~RepeatingThread ()
 
virtual void finishBreak ()
 
int getBreakCounter ()
 
bool isInExclusiveAccess () const
 
void setExclusiveAccess ()
 
void signalInput ()
 
virtual int start ()
 
RepeatingThread::STATUS status () const
 
virtual void takeABreak ()
 
bool testCancel ()
 
void unsetExclusiveAccess ()
 
void waitForInput ()
 

Protected Member Functions

 Server ()
 This constructor is not available.
 
 Server (unsigned int, int, int, int, int)
 This constructor is not available.
 
 Server (unsigned int, int, int, int, unsigned int, int)
 This constructor is not available.
 
 Server (unsigned int, int, int, int, unsigned int, unsigned long, int)
 This constructor is not available.
 
- Protected Member Functions inherited from tcp::Server
 Server ()
 
 Server (unsigned int, int, int, int, int)
 
 Server (unsigned int, int, int, int, unsigned int, int)
 
void clearClientMap ()
 
Server::ServerReceiverTransmittergetClient (SOCKET Socket)
 
unsigned long getMaxClients () const
 
virtual int send (Message *pTcpMessage) override
 
virtual int send (SOCKET ClientSocket, char *pszRawMsg, unsigned int uiRawMsgSize, unsigned int uiMessageID=0, int iActionCode=0, const std::string &rstrInfo="")
 
void setClientMapReceiverValid (bool bValid)
 
virtual void work () override
 
- Protected Member Functions inherited from tcp::TcpMain
 TcpMain ()
 
void setWSACleanup () const
 
int startWinsock () const
 
- Protected Member Functions inherited from eut::RepeatingThread
ORDER getOrder ()
 
STATUS getStatus ()
 
void setStatus (STATUS eStatus)
 
void threadWork ()
 
void toOrder (ORDER eOrder)
 

Private Member Functions

 Server (const Server &)
 
Serveroperator= (const Server &)
 

Private Attributes

Managerm_pGloManager
 

Additional Inherited Members

- Public Types inherited from eut::RepeatingThread
enum  EuTHREADERROR { EuTHREAD_ERR_NO_THREAD = -10301 , EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302 , EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303 , EuTHREAD_ERR_UNKNOWN = -10400 }
 Error range = -10301 to -10400 More...
 
enum  ORDER { eUNDEFINED , eDO_WORK , eEXIT }
 
enum  STATUS {
  eAT_THE_START , eWORKING , ePAUSING , eENDING ,
  eCOMPLETED
}
 
- Public Attributes inherited from eut::RepeatingThread
std::string m_strDebugInfo
 
- Protected Attributes inherited from tcp::Server
std::map< SOCKET, ServerReceiverTransmitter *, std::less< SOCKET > > m_ClientMap
 
ServerAcceptReceiverm_pAcceptReceiver
 
- Protected Attributes inherited from tcp::TcpMain
int m_iAdressFamily
 
int m_iProtocol
 
int m_iSecTimeOut
 
int m_iSocketType
 
SOCKET m_MainSocket
 
unsigned int m_uiDataSize
 
unsigned int m_uiServerPort
 

Detailed Description

The server that communicates with Client's

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Server() [1/6]

glo::Server::Server ( )
protected

This constructor is not available.

◆ Server() [2/6]

glo::Server::Server ( unsigned int ,
int ,
int ,
int ,
int  )
protected

This constructor is not available.

◆ Server() [3/6]

glo::Server::Server ( unsigned int ,
int ,
int ,
int ,
unsigned int ,
int  )
protected

This constructor is not available.

◆ Server() [4/6]

glo::Server::Server ( unsigned int ,
int ,
int ,
int ,
unsigned int ,
unsigned long ,
int  )
protected

This constructor is not available.

◆ Server() [5/6]

glo::Server::Server ( const std::string & rsSchemaPath,
const std::vector< std::string > & rKnownSchemesVector,
unsigned int uiPort,
int iAdressFamily,
int iSocketType,
int iProtocol,
unsigned int uiDataSize,
unsigned long ulMaxClients,
int iSecTimeOut )

The constructor starts the server.

Parameters
[in]rsSchemaPathThe directory where the schemas for the Manager are located.
[in]rKnownSchemesVectorThe known schemas for the Manager.
[in]uiPortThe port of the server.
[in]iAdressFamilyThe socket address family to instantiate a socket (usually AF_INET).
[in]iSocketTypeThe socket type (usually SOCK_STREAM).
[in]iProtocolThe socket protocol (usually 0).
[in]uiDataSizeThe packet size.
[in]ulMaxClientsThe maximum number of clients allowed to connect.
[in]iSecTimeOutThe time until waiting for a connection or waiting for data is aborted.
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ~Server()

virtual glo::Server::~Server ( )
virtual

Destructor.

Reimplemented from tcp::Server.

◆ Server() [6/6]

glo::Server::Server ( const Server & )
private

The copy constructor is not available.

Member Function Documentation

◆ cancel()

virtual void glo::Server::cancel ( )
overridevirtual

When the thread ends, this virtual method is called. The MsgQueue is cleaned up here.

Note
This method only exists when not compiled with POSIX threads (defined (__PTHREADS)).

Reimplemented from tcp::Server.

◆ generateNewServerReceiverTransmitter()

virtual tcp::Server::ServerReceiverTransmitter * glo::Server::generateNewServerReceiverTransmitter ( tcp::Server * pParent,
SOCKET nSocket,
unsigned int uiDataSize ) const
overridevirtual

Returns here a TcpServerReceiverTransmitter with tcp::Transmitter and TcpServerReceiver.

Parameters
[in]pParentServer or subclass.
[in]nSocketSocket of the new client.
[in]uiDataSizeThe Packet Size.
Returns
The TcpServerReceiverTransmitter.

Reimplemented from tcp::Server.

◆ getAllClients()

void glo::Server::getAllClients ( std::vector< ClientInfo > & rClientInfoVector) const

Returns all connected clients.

Parameters
[in,out]rClientInfoVectorThe registered clients with their communicator ID and the name of the open database.

◆ getAllKnownBases()

void glo::Server::getAllKnownBases ( std::vector< std::string > & rKnownBasesVector) const

Copies the names of all known schemas or databases into the transferred Vector.

Parameters
[in,out]rKnownBasesVectorThe names of all known schemas or databases.

◆ getSchemaPath()

std::string glo::Server::getSchemaPath ( ) const

Returns the file path where the schema file can be found.

Returns
Full path name (e.g. "C:/Path/").

◆ getShowLevel()

ShowLevel glo::Server::getShowLevel ( )

Returns the current display level in the Manager.

Returns
The display level.
See also
Manager::ShowLevel()

◆ insertNewClient()

virtual void glo::Server::insertNewClient ( Server::ServerReceiverTransmitter * pNewServerReceiverTransmitter)
overridevirtual

First calls the same method in the superclass. If successful, the Manager is informed that a new client has connected to the Server.

Parameters
[in]pNewServerReceiverTransmitterThe new client socket is in this object.

Reimplemented from tcp::Server.

◆ operator=()

Server & glo::Server::operator= ( const Server & )
private

The assignment operator is not available.

◆ processClientMessage()

virtual void glo::Server::processClientMessage ( tcp::AbstractMessage * pTcpMessage)
overridevirtual

Lets the Manager show what kind of TCP message was received and then passes it to subclass methods with the same name.

If a ServerMessage was passed and its ActionCode == ERR_WRONG_STREAMTYPE the socket of the ServerMessage is closed see ServerMessage::closeSocket() ).

Parameters
[in]pTcpMessageThe message to be processed by the client.

Reimplemented from tcp::Server.

◆ removeClient()

virtual int glo::Server::removeClient ( SOCKET nSocket)
overridevirtual

First calls the same method in the superclass. If successful, the Manager is informed that a client has logged off the Server.

Parameters
[in]nSocketThe socket of the client which should be logged off.
Returns
A return value < 0 indicates an error.

Reimplemented from tcp::Server.

◆ setActionVisualiser()

void glo::Server::setActionVisualiser ( ManagerActionVisualiser * pActionVisualiser)

Sets the action visualizer in Manager.

Parameters
[in]pActionVisualiserThe action visualiser.
Attention
The action visualizer transferred 'becomes' owned by the Manager, so it must not be removed from the memory by the calling entity, this is done by the Manager now.
See also
Manager::setActionVisualiser (...)

◆ setShowLevel()

void glo::Server::setShowLevel ( ShowLevel ulLevel)

Sets the display level in Manager.

Parameters
[in]ulLevelThe display level.
See also
Manager::setShowLevel(ShowLevel)

Member Data Documentation

◆ m_pGloManager

Manager* glo::Server::m_pGloManager
private

Is referenced here to pass an action visualizer and display the TCP actions (if so set).


The documentation for this class was generated from the following file: