#ifndef CLIENT_HPP #define CLIENT_HPP #include "Runtime.hpp" #include "AsyncManager.hpp" #include "Socket.hpp" #include "Sender.hpp" #include "Receiver.hpp" #include "basic-coro/AwaitableTask.hpp" #include #include #include #include #include #ifndef PLATFORM_WINDOWS # include #else # include #endif class Client { struct Exception : public std::runtime_error { using std::runtime_error::runtime_error; }; AsyncManager& aMan; int fd = -1; bool sent = false; hostent *addrInfo; // Can't be null unless request has already been sent std::unique_ptr> connection; void fetchAddr(const std::string& addr, unsigned port); public: Client(const std::string &addr, unsigned port, AsyncManager& asyncManager); basiccoro::AwaitableTask ask(std::string_view prompt, const std::function (unsigned progress)>& on_progress, const std::function (std::string_view token)>& on_token); }; #endif // CLIENT_HPP