void protobuf_codec::send(connection_ptr& conn, const google::protobuf::Message* msg) { std::shared_ptr<buffer> buff(new buffer(65536)); const std::string& typeName = msg->GetTypeName(); const uint16_t nameLen = static_cast<uint16_t>(typeName.size() + 1); const std::string message_data = msg->SerializeAsString(); LOG(INFO)<<"[protobuf_codec],send,typename="<<typeName.c_str(); //TODO: hton buff->append(&nameLen, sizeof(nameLen)); buff->append(typeName.c_str(), nameLen); buff->append(message_data.c_str(), message_data.size()); conn->send_buffer(buff); }