📄 monitortcpslave.h
字号:
#ifndef _MONITOR_TCP_H#define _MONITOR_TCP_H#include "msystem.h"#include "tinycxx/etc.h"#include "tinycxx/exception.h"#include "tinycxx/socket.h"#include "tinycxx/socksvr.h"class CMonitorTCPSlave : public CNBTcpSvr{public: CMonitorTCPSlave(CAllMgr* pAllMgr,const CInetAddress stInetAddr=CInetAddress("*"), tcport_t tPort=2048) : CNBTcpSvr(stInetAddr, tPort) { m_pAllMgr = pAllMgr; m_hThread = 0; m_dwLast = 0; m_dwPrev = 1; } ~CMonitorTCPSlave() { Shutdown(); } bool Init(); bool IsRun() { bool bRet = true; CTimeVal tv; CTimeValSpan tvs = tv - m_tv; if ((tvs.GetASecs() > 20) && (m_dwLast == m_dwPrev)) bRet = false; if (m_dwLast != m_dwPrev) { m_dwLast = m_dwPrev; m_tv = tv; } return bRet; }protected: DWORD m_dwLast,m_dwPrev; CTimeVal m_tv; void RunSlave();protected: virtual bool OnRead(CTcpStream& stTcpStream); virtual bool OnException(CException& e) { /*cout << e << endl; */return true; } virtual bool OnWrite(CTcpStream& stTcpStream); CAllMgr* m_pAllMgr; int processMsg(unsigned char b[],unsigned len);// map<struReg,struLocal> m_mapReg; pthread_t m_hThread; const static WORD m_wBuffSize; friend void* MonitorTCPSlave(void *pVoid);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -