Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ClientNode.h
Package: SwordOnline.rar [view]
Upload User: dzyhzl
Upload Date: 2019-04-29
Package Size: 56270k
Code Size: 3k
Category:
Game Server Simulator
Development Platform:
C/C++
- /********************************************************************
- created: 2003/06/05
- file base: ClientNode
- file ext: h
- author: liupeng
- purpose:
- *********************************************************************/
- #ifndef __INCLUDE_CLIENTNODE_H__
- #define __INCLUDE_CLIENTNODE_H__
- #include "IServer.h"
- #include "HeavenInterface.h"
- #include "Buffer.h"
- #include "CriticalSection.h"
- #include "Event.h"
- #include "kprotocoldef.h"
- #define _NAME_LENGTH 64
- #include <list>
- using namespace std;
- class CClientNode
- {
- public:
- explicit CClientNode( IServer *pServer, size_t id );
- virtual ~CClientNode();
- static bool Start( IServer *pServer );
- static void End();
- static CClientNode *AddNode( IServer *pServer, size_t id );
- static void DelNode( size_t id );
- void AppendData( const void *pData, size_t datalength );
- void Process();
- protected:
- static unsigned int __stdcall ThreadFunction( void *pV );
- static HANDLE m_hThread;
- static OnlineGameLib::Win32::CEvent m_hQuitEvent;
- static OnlineGameLib::Win32::CCriticalSection m_csCL;
- typedef map< size_t, CClientNode * > stdMap;
- static stdMap m_theClientMap;
- void LargePackProcess( const void *pData, size_t dataLength );
- void SmallPackProcess( const void *pData, size_t dataLength );
- private:
- size_t m_nIndentity;
- OnlineGameLib::Win32::CPackager m_theRecv;
- OnlineGameLib::Win32::CPackager m_theSend;
- OnlineGameLib::Win32::CBuffer::Allocator m_theAllocator;
- IServer *m_pServer;
- typedef void ( CClientNode::*ProcessArray[c2s_end] )( const void *pData, size_t dataLength );
- ProcessArray m_theProcessArray;
- void _QueryRoleList( const void *pData, size_t dataLength );
- void _CreateRole( const void *pData, size_t dataLength );
- void _SaveRoleInfo( const void *pData, size_t dataLength );
- void _DelRole( const void *pData, size_t dataLength );
- void _GetRoleInfo( const void *pData, size_t dataLength );
- /*
- * class CDataQueue
- */
- class CDataQueue
- {
- public:
- explicit CDataQueue( size_t bufferSize = 1024 * 64, size_t maxFreeBuffers = 160 );
- ~CDataQueue();
- /*
- * Function
- */
- bool AddData( const BYTE *pData, size_t datalength );
- OnlineGameLib::Win32::CBuffer *Get();
- private:
- /*
- * Data
- */
- OnlineGameLib::Win32::CCriticalSection m_csQueue;
- typedef list< OnlineGameLib::Win32::CBuffer * > stdDataList;
- stdDataList m_theData;
- OnlineGameLib::Win32::CBuffer::Allocator m_theDQAllocator;
- };
- CDataQueue m_theDataQueue;
- };
- #endif // __INCLUDE_CLIENTNODE_H__