31 lines
573 B
C++
31 lines
573 B
C++
#pragma once
|
|
|
|
#include "util.h"
|
|
#include <asio.hpp>
|
|
#include <of_util.h>
|
|
|
|
using namespace ofen;
|
|
class CServer
|
|
{
|
|
public:
|
|
CServer();
|
|
~CServer();
|
|
};
|
|
|
|
class CClient
|
|
{
|
|
public:
|
|
CClient(const std::shared_ptr<spdlog::logger>& logger);
|
|
~CClient();
|
|
public:
|
|
bool Connect(const std::string& host, const std::string& port);
|
|
void Disconnect();
|
|
bool Send(const char* data, int len);
|
|
std::string Receive();
|
|
|
|
private:
|
|
std::shared_ptr<spdlog::logger> logger_;
|
|
asio::io_context io_context_;
|
|
asio::ip::tcp::socket socket_;
|
|
CMutBuffer buffer_;
|
|
}; |