TCPClient.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <signal.h>
  3. #include <iostream>
  4. #include "Util/logger.h"
  5. #include "Network/TcpClient.h"
  6. using namespace std;
  7. using namespace toolkit;
  8. // dataType
  9. #include "SendLogin.h"
  10. #include "NettyServerCommandEnum.h"
  11. #include "NettyServerResultMsg.h"
  12. #include "NettyClientResultMsg.h"
  13. #include "SendLogin.h"
  14. #include "NettyClientCommandEnum.h"
  15. #include "SendHeartBeat.h"
  16. namespace MIVA
  17. {
  18. class TCPClient: public TcpClient
  19. {
  20. private:
  21. /* data */
  22. public:
  23. typedef std::shared_ptr<TCPClient> Ptr;
  24. TCPClient():TcpClient() {
  25. DebugL;
  26. }
  27. ~TCPClient(){
  28. DebugL;
  29. }
  30. protected:
  31. virtual void onConnect(const SockException &ex) override;
  32. virtual void onRecv(const Buffer::Ptr &pBuf) override;
  33. virtual void onFlush() override;
  34. virtual void onErr(const SockException &ex) override;
  35. virtual void onManager() override;
  36. private:
  37. int _nTick = 0;
  38. std::string _IP;
  39. int32_t _port;
  40. };
  41. } // namespace VIA