diff --git a/client/include/client_connection.h b/client/include/client_connection.h index 5115ff1..4089b87 100644 --- a/client/include/client_connection.h +++ b/client/include/client_connection.h @@ -16,14 +16,25 @@ namespace pine class client_connection : public connection { public: + /// @brief Construct a client connection. + /// @param client Reference to the owning client. + /// @param io_context Reference to the asio context. client_connection(client& client, asio::io_context& io_context); + /// @brief Connect to a server. + /// @param host Hostname or ip address of the server. + /// @param port TCP port of the server. + /// @return True if the connection was successful, false otherwise. bool connect(std::string const& host, uint16_t const& port = 80); + /// @brief Disconnect from the server. void disconnect(); + /// @brief Start listening for messages from the server. + /// @return An asynchronous task completed when the connection has been closed. async_task listen(); + /// @brief Error code of the connection. asio::error_code ec; private: