GameClient.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:2k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /********************************************************************
  2. created: 2003/02/18
  3. file base: GameClient
  4. file ext: h
  5. author: liupeng
  6. purpose:
  7. *********************************************************************/
  8. #ifndef __INCLUDE_GAMECLIENT_H__
  9. #define __INCLUDE_GAMECLIENT_H__
  10. #if defined (_MSC_VER) && (_MSC_VER >= 1020)
  11. #pragma once
  12. #endif
  13. //[ Include in ...ESClient
  14. #include "ESClientSocketClient.h"
  15. #include "ESClienttstring.h"
  16. //]
  17. class CGameClient : public OnlineGameLib::Win32::CSocketClient
  18. {
  19. public:
  20. CGameClient(
  21. const OnlineGameLib::Win32::_tstring &addressToConnectServer,
  22. unsigned short portToConnectServer,
  23. size_t maxFreeBuffers,
  24. size_t bufferSize = 1024
  25. );
  26. CGameClient(
  27. size_t maxFreeBuffers,
  28. size_t bufferSize = 1024
  29. );
  30. virtual ~CGameClient();
  31. private:
  32. virtual SOCKET CreateConnectionSocket( 
  33. const OnlineGameLib::Win32::_tstring &addressToConnectServer,
  34. unsigned short port);
  35. virtual void OnStartConnections();
  36. virtual void OnStopConnections();
  37. virtual void OnShutdownInitiated();
  38. virtual void OnShutdownComplete();
  39. virtual void OnConnect();
  40. virtual void OnClose();
  41. virtual void ReadCompleted( OnlineGameLib::Win32::CIOBuffer *pBuffer );
  42. virtual void OnError( const OnlineGameLib::Win32::_tstring &message );
  43. size_t GetMinimumMessageSize() const;
  44. size_t GetMessageSize( const OnlineGameLib::Win32::CIOBuffer *pBuffer ) const;
  45. OnlineGameLib::Win32::CIOBuffer *ProcessDataStream(
  46. OnlineGameLib::Win32::CIOBuffer *pBuffer);
  47. void ProcessCommand( const OnlineGameLib::Win32::CIOBuffer *pBuffer);
  48. virtual void PreWrite( 
  49. OnlineGameLib::Win32::CIOBuffer *pBuffer, 
  50. const char *pData, 
  51. size_t dataLength );
  52. // No copies do not implement
  53. CGameClient( const CGameClient &rhs );
  54. CGameClient &operator=( const CGameClient &rhs );
  55. };
  56. #endif //__INCLUDE_GAMECLIENT_H__