Esempio n. 1
0
	void send_to_connection(buf_ptr buf, short message_id, int size) {
		((Header*)write_header_)->message_id = message_id;
		((Header*)write_header_)->body_size = size;
		std::memcpy(write_data_, write_header_, sizeof(Header));
		std::memcpy(write_data_ + sizeof(Header), buf->get_buffer(), size);
		do_write(size + sizeof(Header));
		do_write(size + sizeof(Header));
	}
	void do_write(buf_ptr buf){
		boost::asio::async_write(socket_, boost::asio::buffer(buf->get_buffer(), buf->get_size()),[&buf](const boost::system::error_code&, std::size_t){});
	}