I am having problems where my message fails to serialize. A fatal exception
is thrown for the ' ResponseMessage.SerializeToCodedStream(coded_output);'.
ResponseMessage contains all the required fields, and is 104 bytes without
the varint....
I am compiling this for 64 bit windows, using the 32bit protoc.exe.
// Send the response message
// Get the byte size of the response message
uint32_t response_message_size = ResponseMessage.ByteSize();
// Add the varint size to the total message size
uint32_t response_message_total_size = response_message_size
+ google::protobuf::io::CodedOutputStream::VarintSize32(response_message_size);
boost::asio::streambuf buffer_stream;
std::ostream output_stream(&buffer_stream);
google::protobuf::io::ZeroCopyOutputStream* raw_output =
new google::protobuf::io::OstreamOutputStream(&output_stream);
google::protobuf::io::CodedOutputStream* coded_output =
new google::protobuf::io::CodedOutputStream(raw_output);
try
{
coded_output->WriteVarint32(response_message_size);
ResponseMessage.SerializeToCodedStream(coded_output);
delete coded_output;
delete raw_output;
bytes_sent = m_Socket.send(buffer_stream.data());
}
catch( google::protobuf::FatalException )
{
assert(false);
delete raw_output;
delete coded_output;
bytes_sent = 0;
}
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/protobuf/-/rT511FevwuQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.