⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vnetservice.h

📁 otl简单包装实现类,对数据库进行操作的,简单易用.
💻 H
字号:
/***************************************************************************                          VNetService.h -  description                             -------------------    begin                : 11.21 10:18:00 CST 2003    copyright            : (C) 2003 by |LiuZhong|    email                : |zliu@foundermn.com| ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef VNETSERVICE_H#define VNETSERVICE_H #include "vrssocket.h"#include "linuxh.h"#include "vbaseobject.h"class VNetService{private:	string  m_Address;	int     m_Port;	bool    m_bNoDelay;	bool    m_bReUseAddr;	bool    m_bLingerOn;	int     m_LingerSec;	int     m_SendBufLen;	int     m_RecvBufLen;	int     m_ListenNum;private:	typedef struct targ{		VNetService*  m_Self;		CRSSocket*    m_pAny;	} TArg;	static void* ServiceThread(void* pArg);public:	CRSSocket m_ServiceRs;	bool    m_bService;        void SetTcpNoDelay(bool bNoDelay);	void SetReUseAddr(bool bReUseAddr);	void SetRecvBuf(int RecvBufLen);	void SetSendBuf(int SendBufLen);	void SetLinger(bool bOn,int LingerSec);		void SetListenNum(int Num);	int SelectWait(long SEvent=FD_READ,long MSec=0);public:	VNetService();	virtual ~VNetService();	int  StartService(const char* Address,int Port);	int  StopService();	int  GetNewClient(CRSSocket** ClientRs);	int  DoService(int MSec=0);	virtual void ClientService(CRSSocket* ClientRs);	virtual void ServiceTimeOut();};class VNetService2: public VNetService{private:	long  m_BaseNum;	long  m_RealNum;        long  m_EmptyNum;	deque<CRSSocket*>  m_ClientList;        VCritiSec    m_CriClient;        VCritiSec    m_CriReal;        VCritiSec    m_CriEmpty;        VEvent        m_RunEvent;private:	static void* ServiceThread2(void* pArg);	void  ClientControl(); 	       void  AddToEmpty();       void  RemoveFromEmpty();       void  AddToClientList(CRSSocket* ClientRs);       CRSSocket* RemoveFromClientList();       void  AddRealNum();       void  RemoveRealNum();public:	VNetService2();	virtual ~VNetService2();       int  SetBaseNum(long BaseNum);       int  DoService2(int MSec=0);	virtual void ClientService(CRSSocket* ClientRs);	virtual void ServiceTimeOut();};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -