13 const char*
what() const noexcept
override {
return _message.c_str(); }
35 void connect(
const std::string& host,
int port);
42 void send(
const std::string& data);
49 std::optional<std::string>
recvLine();
57 bool poll(
int timeout_ms);
Exception class for TCP errors.
const char * what() const noexcept override
TcpException(const std::string &message)
Simple TCP socket wrapper.
~TcpSocket()
Wraps close().
std::optional< std::string > recvLine()
Receives a line of text from the socket.
void send(const std::string &data)
Sends data through the socket.
bool poll(int timeout_ms)
Polls the socket for incoming data.
void connect(const std::string &host, int port)
Connects to a remote host.