#pragma once

#include "abstract_coder.hpp"
#include "client_tcp_connect.hpp"
#include "net_address.hpp"
#include "reactor.hpp"

namespace tinyrpc {
    class TcpClient {
    public:
        TcpClient(const NetAddress& peerAddr);
        AbstractCoder& getCoder() {return *m_coder;}
        ~TcpClient();
    private:
        int m_fd{-1};
        NetAddress m_local_addr{};
        NetAddress m_peer_addr{};
        Reactor& m_reactor;
        ClientTcpConnection *m_connection;
        AbstractCoder* m_coder{};
    };

}