4 #include <boost/asio/streambuf.hpp>
5 #include <boost/asio.hpp>
20 using namespace boost::asio;
21 char header[17] = {0};
23 boost::asio::streambuf buf;
25 read(*socket, buffer(header, 16));
26 size_t size_of_msg = atoi(header);
28 size_t l = read(*socket, buf.prepare(size_of_msg));
34 T* m =
dynamic_cast<T*
>(msg);
35 return std::unique_ptr<T>(m);
Message * load_message(std::string &str)
Definition: factory.cc:18
auto read_reply(boost::asio::ip::tcp::socket *socket)
Definition: factory.hh:19
Definition: message.hh:15
std::string * save_message(Message *m)
Definition: factory.cc:46
void send_message(boost::asio::ip::tcp::socket *socket, eclipse::messages::Message *msg)
Definition: factory.cc:69