No response from Aerospike

  aerospike, c++

I am writing my own Aerospike client in C ++ and I have a problem: although my request seems to reach the server (if you send nonsense, the connection will be dropped), the server does not return any response.

Here is my code:

#include <boost/asio.hpp>
#include <boost/array.hpp>
#include <iostream>

void read_message(boost::asio::ip::tcp::socket& socket)
    for (;;)
      boost::array<char, 1> buf;
      boost::system::error_code error;
      size_t len = socket.read_some(boost::asio::buffer(buf), error);
      if (error == boost::asio::error::eof)
      else if (error)
        throw boost::system::system_error(error);
      std::cout.write(, len);
      std::cout << std::endl;

void send_message(boost::asio::ip::tcp::socket& socket, std::string message)
    boost::array<char, 1024> buf;
    std::copy(message.begin(), message.end(), buf.begin());
    boost::system::error_code error;
    socket.write_some(boost::asio::buffer(buf, message.size()), error);

int main()
    std::cout << "Connecting to socket.." << std::endl;
    boost::asio::io_service ios;
    boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string(""), 3000);
    boost::asio::ip::tcp::socket socket(ios);
    std::cout << "Connected to socket. Writing message." << std::endl;
    send_message(socket, "x02x01x00x00x00x00x006buildneditionnnodenservicenservicesnstatisticsnversion");
    std::cout << "Writed message. Reading response." << std::endl;
    std::cout << "Read response. Exiting prigram." << std::endl;
    return 0;

This code works correctly with, for example, – HTML is returned with the words “Bad request”.

Source: StackOverflow C++