TCPClient.h 826 B

12345678910111213141516171819202122232425262728293031323334
  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. namespace VIA
  9. {
  10. class TCPClient: public TcpClient
  11. {
  12. private:
  13. /* data */
  14. public:
  15. typedef std::shared_ptr<TCPClient> Ptr;
  16. TCPClient():TcpClient() {
  17. DebugL;
  18. }
  19. ~TCPClient(){
  20. DebugL;
  21. }
  22. protected:
  23. virtual void onConnect(const SockException &ex) override;
  24. virtual void onRecv(const Buffer::Ptr &pBuf) override;
  25. virtual void onFlush() override;
  26. virtual void onErr(const SockException &ex) override;
  27. virtual void onManager() override;
  28. private:
  29. int _nTick = 0;
  30. std::string _IP;
  31. int32_t _port;
  32. };
  33. } // namespace VIA