10#include <boost/asio/connect.hpp>
13#include <aedis/src.hpp>
15namespace net = boost::asio;
16namespace resp3 = aedis::resp3;
19auto main(
int argc,
char * argv[]) ->
int
22 std::string host =
"127.0.0.1";
23 std::string port =
"6379";
31 net::ip::tcp::resolver resv{ioc};
32 auto const res = resv.resolve(host, port);
33 net::ip::tcp::socket socket{ioc};
34 net::connect(socket, res);
39 req.
push(
"PING",
"Hello world");
44 std::string buffer, resp;
47 auto dbuffer = net::dynamic_buffer(buffer);
52 std::cout <<
"Ping: " << resp << std::endl;
54 }
catch (std::exception
const& e) {
55 std::cerr << e.what() << std::endl;
void push(std::string_view cmd, Ts const &... args)
Appends a new command to the end of the request.
auto adapt2() noexcept
Creates a dummy response adapter.
auto write(SyncWriteStream &stream, Request const &req)
Writes a request synchronously.
auto read(SyncReadStream &stream, DynamicBuffer buf, ResponseAdapter adapter, boost::system::error_code &ec) -> std::size_t
Reads a complete response to a command sychronously.