Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cPingClient.h
Go to the documentation of this file.
1 //
5 //
6 
7 #ifndef _INC_cPingClient_H
8 #define _INC_cPingClient_H
9 #ifndef NO_PRAGMA_ONCE
10 #pragma once
11 #endif
12 
13 #include "cPingCommon.h"
14 #include "../Net/cNetAddrName.h"
15 
16 namespace GrayLib
17 {
19 
21  {
26  public:
28 
29  private:
30  cTimeSys m_timeTxOldest;
31  cTimeSys m_timeTxNewest;
32  cTimeSys m_timeRx;
33  TIMESYSD_t m_timeLagMax;
34 
35  public:
38  {
39  }
40 
41  void InitClientData();
42  bool HasResponse() const;
43  TIMESYSD_t CheckTimeLagMax();
44  bool CheckPingTime(TIMESYS_t timeNow, TIMESYSD_t nTimeThrottle = cTimeSys::k_FREQ * 10);
45  void OnRxEchoResp(TIMESYS_t timeSent);
46  virtual HRESULT OnPingRx(HRESULT hRes, const BYTE* pPayload, size_t nPayloadLen);
47  };
48 
50  {
55  public:
56  cPingClient(const IPingProtocol* pForm );
57  virtual ~cPingClient();
58 
59  HRESULT PingSendGeneric(const cNetAddress& AddrServer, const BYTE* pData, size_t iLen);
60  HRESULT PingSendEcho(cPingClientQuery& server, TIMESYSD_t nTimeThrottle = cTimeSys::k_FREQ * 10);
61 
62  HRESULT onTickPingSimple(cPingClientQuery& server);
63 
65  };
66 }
67 #endif // _INC_cPingClient_H
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cNetAddr.h:31
Definition: cPingClient.h:21
virtual ~cPingClientQuery()
Definition: cPingClient.h:37
cNetAddress m_AddrServer
address of the server we are pinging.
Definition: cPingClient.h:27
Definition: cPingClient.h:50
UNITTEST_FRIEND(cPingClient)
Definition: cPingCommon.h:65
Definition: cTimeSys.h:93
static const TIMESYS_t k_FREQ
milliSec per Sec
Definition: cTimeSys.h:100
Definition: cPingCommon.h:16
Definition: cMesh.h:22
UNITTEST2_PREDEF(cQuadtree)
INT32 TIMESYSD_t
Time delta. signed milli-Seconds Span. cTimeSys::k_DMAX, cTimeSys::k_INF = MAILSLOT_WAIT_FOREVER.
Definition: cTimeSys.h:28
UINT32 TIMESYS_t
TIMESYS_t = The normal system tick timer. milli-seconds since start of system/app ?
Definition: cTimeSys.h:27