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

The client, which communicates with a GloServer. More...

#include <GloClient.h>

Inheritance diagram for glo::Client:

Public Member Functions

 Client (ClientThread *pParentClientThread, const std::string &rstrHostname, unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, int iSecTimeOut)
virtual ~Client ()
virtual int disconnectServer ()
virtual void processServerMessage (tcp::Message *pTcpMessage)
int sendOrder (OrderMsg *pOrderMsg)
void setWsaeConnResetGloServerCallBack (CallBack *pCallBack)
Public Member Functions inherited from tcp::Client
 Client (const std::string &rsHostname, unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, int iSecTimeOut)
 Client (const std::string &rsHostname, unsigned int uiPort, int iAdressFamily, int iSocketType, int iProtocol, unsigned int uiDataSize, int iSecTimeOut)
int acceptServerMessage (Message *pTcpServerMessage)
virtual void cancel () override
int connectServer ()
std::string getHostName () const
int getPeerName (std::string &rsIPAdress, unsigned int &ruiPort) const
int getSocketAdrFromString (SOCKADDR_IN *Socketadress, const std::string &rsHostnameOrIp) const
ActionCode getWaitingServerMsgActionCode () const
bool isServerConnected () const
virtual int send (char *pszRawMsg, unsigned int uiRawMsgSize, unsigned int uiMessageID=0, int iActionCode=0, const std::string &rsInfo="")
virtual int send (Message *pTcpMessage) override
virtual void setDataSize (unsigned int uiDataSize) override
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
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

 Client ()
 Client (unsigned int, int, int, int, int)
 Client (const std::string &, unsigned int, int, int, int, int)
 Client (const std::string &, unsigned int, int, int, int, unsigned int, int)
Protected Member Functions inherited from tcp::Client
 Client ()
 Client (unsigned int, int, int, int, int)
virtual ClientReceivergenerateNewReceiver ()
virtual TransmittergenerateNewTransmitter ()
virtual int syncDataSize ()
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

 Client (const Client &)
Clientoperator= (const Client &)

Private Attributes

OrderMsgm_pCurrentOrder
ClientThreadm_pParentClientThread
CallBackm_pWsaeConnResetGloServerCallBack

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::Client
ClientReceiverm_pReceiver
Transmitterm_pTransmitter
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 client, which communicates with a GloServer.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Client() [1/6]

glo::Client::Client ( )
protected

This constructor is not available.

Referenced by Client(), and operator=().

◆ Client() [2/6]

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

This constructor is not available.

◆ Client() [3/6]

glo::Client::Client ( const std::string & ,
unsigned int ,
int ,
int ,
int ,
int  )
protected

This constructor is not available.

◆ Client() [4/6]

glo::Client::Client ( const std::string & ,
unsigned int ,
int ,
int ,
int ,
unsigned int ,
int  )
protected

This constructor is not available.

◆ Client() [5/6]

glo::Client::Client ( ClientThread * pParentClientThread,
const std::string & rstrHostname,
unsigned int uiPort,
int iAdressFamily,
int iSocketType,
int iProtocol,
int iSecTimeOut )

The constructor starts the client, but is not yet connected to the server from rstrHostname.

Parameters
[in]pParentClientThreadThe back reference to the instantiating ClientThread.
[in]rstrHostnameThe host name or IP address (e.g. "LOCALHOST" or "192.168.2.102").
[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]iSecTimeOutThe time until waiting for a connection or waiting for data is aborted.
Exceptions
eut::ErrorNExceptionAn exception is thrown if an error occurs.

◆ ~Client()

virtual glo::Client::~Client ( )
virtual

Destructor.

Reimplemented from tcp::Client.

◆ Client() [6/6]

glo::Client::Client ( const Client & )
private

The copy constructor is not available.

References Client().

Member Function Documentation

◆ disconnectServer()

virtual int glo::Client::disconnectServer ( )
virtual

The connection to the server is terminated.
If there is a possibly pending order, it will be transmitted to the m_pParentClientThread with an error message ::ERR_SERVER_CONNECTION_BROKEN.

Returns
A return < 0 indicates an error. If there was a pending order, this is not an error which is returned as return value.

Reimplemented from tcp::Client.

◆ operator=()

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

The assignment operator is not available.

References Client().

◆ processServerMessage()

virtual void glo::Client::processServerMessage ( tcp::Message * pTcpMessage)
virtual

Verarbeitet eine Nachricht vom Server. Wenn es eine Antwort auf einen Auftrag ist, wird der Auftrag um die Informationen vom Server erweitert. Wenn eine Information, wird ein Auftrag generiert. So oder so, der Auftrag wird an den m_pParentClientThread übermittelt.

Parameters
[in]pTcpMessageDie zu verarbeitende Nachricht vom Server.
Exceptions
eut::ErrorNExceptionBei einem Fehler wird eine Exception geworfen.

Reimplemented from tcp::Client.

◆ sendOrder()

int glo::Client::sendOrder ( OrderMsg * pOrderMsg)

Converts the order into a streamable buffer and sends it to the server.

Parameters
[in]pOrderMsgThe order to be sent.
Returns
A return < 0 indicates an error.
See also
OrderMsg::streamOrderInBlob(eut::Blob&,EnStreamOrderDataType)const
tcp::Client::send(char*,unsigned int,unsigned int,int,const std::string& )

◆ setWsaeConnResetGloServerCallBack()

void glo::Client::setWsaeConnResetGloServerCallBack ( CallBack * pCallBack)

Sets m_pWsaeConnResetGloServerCallBack.

Parameters
[in]pCallBackIf a valid object, CallBack::notify(glo::NotifyNote&) will be called with corresponding glo::NotifyNote if the connection to the GloServer is lost.

Member Data Documentation

◆ m_pCurrentOrder

OrderMsg* glo::Client::m_pCurrentOrder
private

The current order is kept to transmit a response from the server. In principle, the client only sends requests with an expected response.

◆ m_pParentClientThread

ClientThread* glo::Client::m_pParentClientThread
private

The client thread is a parent object (it instantiates an object of this class) and must be in access because of the server's responses.

◆ m_pWsaeConnResetGloServerCallBack

CallBack* glo::Client::m_pWsaeConnResetGloServerCallBack
private

If set, CallBack::notify(glo::NotifyNote&) will be called with corresponding glo::NotifyNote if the connection to the GloServer is lost.


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