123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /*
- * @Description: TCPClient
- * @Version: 1.0
- * @Autor: lishengyin
- * @Date: 2021-09-13 17:30:20
- * @LastEditors: lishengyin
- * @LastEditTime: 2021-11-18 17:48:35
- */
- #pragma once
- #include <signal.h>
- #include <iostream>
- #include "Util/logger.h"
- #include "Network/TcpClient.h"
- #include "Util/NoticeCenter.h"
- #include "Notices.h"
- #include "md5.h"
- #include <time.h>
- #include <ctime>
- using namespace std;
- using namespace toolkit;
- // dataType
- #include "SendLogin.h"
- #include "NettyServerCommandEnum.h"
- #include "NettyServerResultMsg.h"
- #include "NettyClientResultMsg.h"
- #include "SendLogin.h"
- #include "NettyClientCommandEnum.h"
- #include "SendHeartBeat.h"
- #include "Util/logger.h"
- #include "Util/NoticeCenter.h"
- #include "Poller/EventPoller.h"
- #include "Player/PlayerProxy.h"
- #include "Rtmp/RtmpPusher.h"
- #include "Common/config.h"
- #include "Pusher/MediaPusher.h"
- #include "Extension/Frame.h"
- #include "Util/SqlPool.h"
- #include "Network/TcpClient.h"
- #include "Poller/Timer.h"
- namespace MIVA
- {
- class TCPClient: public TcpClient
- {
- public:
- std::string privateKey = "mwWAH2eUAAHodlRt";
- std::string Account = "nettyUser2";
- std::string pwd = "sunwin20211102";
- public:
- typedef std::shared_ptr<TCPClient> Ptr;
- TCPClient():TcpClient() {
- DebugL;
- }
- ~TCPClient(){
- DebugL;
- }
- protected:
- /**
- * @description: 连接成功时触发
- * @param {SockException} &ex 连接info
- * @return {*}
- * @author: lishengyin
- */
- virtual void onConnect(const SockException &ex) override;
- /**
- * @description: 接收数据时触发
- * @param {Ptr} &pBuf 接受到的数据
- * @return {*}
- * @author: lishengyin
- */
- virtual void onRecv(const Buffer::Ptr &pBuf) override;
- /**
- * @description: 发送阻塞时触发
- * @param {*}
- * @return {*}
- * @author: lishengyin
- */
- virtual void onFlush() override;
- /**
- * @description: EOF时触发
- * @param {SockException} &ex 错误信息
- * @return {*}
- * @author: lishengyin
- */
- virtual void onErr(const SockException &ex) override;
- /**
- * @description: 心跳 2S触发一次
- * @param {*}
- * @return {*}
- * @author: lishengyin
- */
- virtual void onManager() override;
- private:
- int _nTick = 0;
- std::string _IP;
- int32_t _port;
- };
- } // namespace VIA
|