25 lines
792 B
C++
25 lines
792 B
C++
#pragma once
|
|
#include "../common/seq_packet.h"
|
|
|
|
class client
|
|
{
|
|
public:
|
|
client(boost::asio::io_context & io_context, const std::string & unix_file, std::function<void(const std::vector<uint8_t>&)> func_cb = nullptr);
|
|
~client();
|
|
|
|
void write(const std::vector<uint8_t> & data);
|
|
void do_close();
|
|
|
|
private:
|
|
client(const client&) = delete;
|
|
const client& operator=(const client&) = delete;
|
|
|
|
seq_packet::seqpacket_protocol::socket socket_;
|
|
std::array<uint8_t, 2000> data_;
|
|
std::function<void(const std::vector<uint8_t>&)> callback_func;
|
|
|
|
void handle_connect(const boost::system::error_code & error);
|
|
void handle_read(const boost::system::error_code & error, size_t bytes_transferred);
|
|
void start();
|
|
};
|