GlobalObjects
|
The client, which communicates with a GloServer. More...
#include <GloClient.h>
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 ClientReceiver * | generateNewReceiver () |
virtual Transmitter * | generateNewTransmitter () |
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 &) | |
Client & | operator= (const Client &) |
Private Attributes | |
OrderMsg * | m_pCurrentOrder |
ClientThread * | m_pParentClientThread |
CallBack * | m_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 | |
ClientReceiver * | m_pReceiver |
Transmitter * | m_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 |
The client, which communicates with a GloServer.
|
protected |
This constructor is not available.
|
protected |
This constructor is not available.
|
protected |
This constructor is not available.
|
protected |
This constructor is not available.
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.
[in] | pParentClientThread | The back reference to the instantiating ClientThread. |
[in] | rstrHostname | The host name or IP address (e.g. "LOCALHOST" or "192.168.2.102"). |
[in] | uiPort | The port of the server. |
[in] | iAdressFamily | The socket address family to instantiate a socket (usually AF_INET). |
[in] | iSocketType | The socket type (usually SOCK_STREAM). |
[in] | iProtocol | The socket protocol (usually 0). |
[in] | iSecTimeOut | The time until waiting for a connection or waiting for data is aborted. |
eut::ErrorNException | An exception is thrown if an error occurs. |
|
virtual |
Destructor.
Reimplemented from tcp::Client.
|
private |
The copy constructor is not available.
|
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.
Reimplemented from tcp::Client.
The assignment operator is not available.
|
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.
[in] | pTcpMessage | Die zu verarbeitende Nachricht vom Server. |
eut::ErrorNException | Bei einem Fehler wird eine Exception geworfen. |
Reimplemented from tcp::Client.
int glo::Client::sendOrder | ( | OrderMsg * | pOrderMsg | ) |
Converts the order into a streamable buffer and sends it to the server.
[in] | pOrderMsg | The order to be sent. |
void glo::Client::setWsaeConnResetGloServerCallBack | ( | CallBack * | pCallBack | ) |
Sets m_pWsaeConnResetGloServerCallBack.
[in] | pCallBack | If a valid object, CallBack::notify(glo::NotifyNote&) will be called with corresponding glo::NotifyNote if the connection to the GloServer is lost. |
|
private |
The current order is kept to transmit a response from the server. In principle, the client only sends requests with an expected response.
|
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.
|
private |
If set, CallBack::notify(glo::NotifyNote&) will be called with corresponding glo::NotifyNote if the connection to the GloServer is lost.