25 lines
431 B
C++
25 lines
431 B
C++
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "aliases.hpp"
|
||
|
|
#include "logger.hpp"
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
class EchoClient final
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
EchoClient(IoContext &io, std::string host, unsigned short port);
|
||
|
|
|
||
|
|
bool run(const std::string &message);
|
||
|
|
|
||
|
|
private:
|
||
|
|
bool connect();
|
||
|
|
bool send(const std::string &message);
|
||
|
|
void close();
|
||
|
|
|
||
|
|
private:
|
||
|
|
IoContext &io_;
|
||
|
|
std::string host_;
|
||
|
|
unsigned short port_;
|
||
|
|
TcpSocket socket_{io_};
|
||
|
|
};
|