The delimiter is actually a varint <https://developers.google.com/protocol-buffers/docs/encoding#varints> (variable-sized int), which can store values up to 127 in a single byte. So it sounds plausible that your delimited message only required 3 bytes. That could be one byte for the delimiter indicating a 2-byte message, and then the message itself consisting of a one-byte tag and a one-byte RequestId.
On Tue, Jun 26, 2018 at 8:16 AM Natalia Zhukova <[email protected]> wrote: > Hello, > I use SerializeDelimitedToCodedStream function to serialize message with > one RequestId field and send it over socket > > message resMessage > { > bytes RequestId = 1; > } > > > ArrayOutputStream arr(buffer, buffer_size); > CodedOutputStream output(&arr); > > SerializeDelimitedToCodedStream(message, &output); > > *int retb *= output.ByteCount(); > > > Is it possible that *retb *is only 3 bytes, if delimiter itself is 4 > bytes. > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
