tinyrpc/includes/net/tcp/client_tcp_connect.hpp

26 lines
690 B
C++
Raw Normal View History

2025-02-04 16:09:27 +08:00
#pragma once
#include "abstract_coder.hpp"
#include "abstract_tcp_connect.hpp"
2025-02-05 20:50:31 +08:00
#include "tcp_buffer.hpp"
2025-02-04 16:09:27 +08:00
#include <memory>
namespace tinyrpc {
class TcpClient;
2025-02-05 20:50:31 +08:00
class ClientTcpConnection : public AbstractTcpConnection {
2025-02-04 16:09:27 +08:00
public:
ClientTcpConnection(int fd, Reactor& reactor, TcpClient& cli);
~ClientTcpConnection();
2025-02-05 20:50:31 +08:00
TcpBuffer& getSendBuffer() {return m_writeBuffer;}
bool getResPackageData(const std::string& msg_req, std::shared_ptr<AbstractData>& pb_struct);
2025-02-04 16:09:27 +08:00
void process() override;
private:
TcpClient& m_client;
std::unordered_map<std::string, std::shared_ptr<AbstractData>> m_respond_datas; // cli
};
}