Skip to content

Commit

Permalink
Document client_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacquwes committed Sep 29, 2023
1 parent f4430ee commit a0b2066
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/include/client_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a0b2066

Please sign in to comment.