TwoShipperSocket.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _WATCHSERVERSOCKET_HN_
  2. #define _WATCHSERVERSOCKET_HN_
  3. #include "StoneU_TcpS.h"
  4. #include "StoneU_TcpC.h"
  5. //---------------------------------------------- CDevicesManager ----
  6. class CTwoShipperSocket:public CStoneU_TcpS,public CStoneU_TcpC
  7. {
  8. public:
  9. CTwoShipperSocket();
  10. CTwoShipperSocket(int nIsInSlave);
  11. ~CTwoShipperSocket();
  12. bool m_bClientLoginServerSuccess;
  13. CString m_sLocalGateway;
  14. CString m_sClientIP;
  15. public:
  16. virtual void DllS_ThreadBegin( CString sServerIP );
  17. virtual void DllS_ThreadExit( CString sServerIP );
  18. virtual void DllS_AddConnection( CString sServerIP,CString sClientIP);
  19. virtual void DllS_DataReceived( CString sServerIP,const BYTE* pbData, DWORD dwCount, CString sClientIP );
  20. virtual void DllS_ConnectionFailure( CString sServerIP,CString sClientIP);
  21. virtual void DllS_ConnectionDropped(CString sServerIP,CString sClientIP);
  22. virtual void DllS_ConnectionError( CString sServerIP,DWORD dwError);
  23. virtual void DllC_ThreadBegin(CString sLocalIP);
  24. virtual void DllC_ThreadExit(CString sLocalIP);
  25. virtual void DllC_DataReceived(CString sLocalIP,const BYTE* pbData, DWORD dwCount, CString sServerIP);
  26. virtual void DllC_ConnectionDropped(CString sLocalIP,CString sServerIP);
  27. virtual void DllC_ConnectionError(CString sLocalIP,DWORD dwError);
  28. protected:
  29. static DWORD WINAPI SendHeartProc( CTwoShipperSocket *pWatchServer );
  30. static DWORD WINAPI CheckHeartProc( CTwoShipperSocket *pWatchServer );
  31. HANDLE m_hHeartHandle;
  32. bool m_bHeartExit;
  33. private:
  34. CString m_strServerIP;
  35. CString m_strServerPort;
  36. bool m_bIsServer;
  37. unsigned int CalcCheckSum( void *pData, unsigned int nSize );
  38. DWORD m_dwServiceOnlineTick;
  39. void ProcessHeart(void *pData, int nLen);
  40. void ProcessData( CSocketHandle *pSH,const BYTE* pData, DWORD nLen);
  41. int OnCmdProcess(void *pData);
  42. };
  43. #endif