42 lines
		
	
	
		
			869 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			869 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef _CCEX_PIPE_SERVER_H__
 | 
						|
#define _CCEX_PIPE_SERVER_H__
 | 
						|
#include "CCEXPipe.h"
 | 
						|
#include "CCEXPipeLib.h"
 | 
						|
#include <WinSock2.h>
 | 
						|
 | 
						|
class CCEXPipeServer :public CCEXPipeServerBase
 | 
						|
{
 | 
						|
	friend unsigned int __stdcall g_PipServerThr(void* pPara);
 | 
						|
public:
 | 
						|
	CCEXPipeServer();
 | 
						|
	~CCEXPipeServer();
 | 
						|
 | 
						|
protected:
 | 
						|
	virtual BOOL SendeData(const char* pData, int lLen);
 | 
						|
	virtual BOOL SendeMsg(int lMsgId, const char* pData, int lLen);
 | 
						|
	virtual BOOL Start(const char* pPipeName);
 | 
						|
	virtual BOOL Stop();
 | 
						|
	unsigned int ServerThr();
 | 
						|
	virtual BOOL IsAcitve(){return m_bActive;}
 | 
						|
	virtual BOOL IsConnect(){return m_socket != -1;}
 | 
						|
 | 
						|
	//激活状态下睡眠等待,停止激活时立即中断
 | 
						|
	BOOL SleepForActive(int lMs);
 | 
						|
 | 
						|
private:
 | 
						|
 | 
						|
	HANDLE m_hServerThr;
 | 
						|
	BOOL m_bActive;
 | 
						|
 | 
						|
	//本地连接端口号
 | 
						|
	short m_lPort;
 | 
						|
 | 
						|
	SOCKET m_LisentSock;
 | 
						|
	SOCKET m_socket;
 | 
						|
 | 
						|
	//socket同步访问保护
 | 
						|
	CRITICAL_SECTION m_cySocket;
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
#endif |