#ifndef _WATCHSERVERSOCKET_HN_ #define _WATCHSERVERSOCKET_HN_ #include "StoneU_TcpS.h" #include "StoneU_TcpC.h" //---------------------------------------------- CDevicesManager ---- class CTwoShipperSocket:public CStoneU_TcpS,public CStoneU_TcpC { public: CTwoShipperSocket(); CTwoShipperSocket(int nIsInSlave); ~CTwoShipperSocket(); bool m_bClientLoginServerSuccess; CString m_sLocalGateway; CString m_sClientIP; public: virtual void DllS_ThreadBegin( CString sServerIP ); virtual void DllS_ThreadExit( CString sServerIP ); virtual void DllS_AddConnection( CString sServerIP,CString sClientIP); virtual void DllS_DataReceived( CString sServerIP,const BYTE* pbData, DWORD dwCount, CString sClientIP ); virtual void DllS_ConnectionFailure( CString sServerIP,CString sClientIP); virtual void DllS_ConnectionDropped(CString sServerIP,CString sClientIP); virtual void DllS_ConnectionError( CString sServerIP,DWORD dwError); virtual void DllC_ThreadBegin(CString sLocalIP); virtual void DllC_ThreadExit(CString sLocalIP); virtual void DllC_DataReceived(CString sLocalIP,const BYTE* pbData, DWORD dwCount, CString sServerIP); virtual void DllC_ConnectionDropped(CString sLocalIP,CString sServerIP); virtual void DllC_ConnectionError(CString sLocalIP,DWORD dwError); protected: static DWORD WINAPI SendHeartProc( CTwoShipperSocket *pWatchServer ); static DWORD WINAPI CheckHeartProc( CTwoShipperSocket *pWatchServer ); HANDLE m_hHeartHandle; bool m_bHeartExit; private: CString m_strServerIP; CString m_strServerPort; bool m_bIsServer; unsigned int CalcCheckSum( void *pData, unsigned int nSize ); DWORD m_dwServiceOnlineTick; void ProcessHeart(void *pData, int nLen); void ProcessData( CSocketHandle *pSH,const BYTE* pData, DWORD nLen); int OnCmdProcess(void *pData); }; #endif