Hi all,

I am using C++ to send protobuf messages with repeated fields over a 
socket. Note that repeated fields are also protobuf messages.

To send a protobuf message over a socket, I am serializing it with 
SerializeToString, and then I am sending the string over the socket in a 
packet. My network packet contains a uint32_t which contains the size of 
the packet and the serialized protobuf string. The size of the packet is 
obtained by calling sizeof(serialized_protobuf_message).

When I receive the packet on the other side of the network, I determine the 
size of the serialized protobuf message, read this amount of bytes from the 
socket, and then attempt to parse it back into a protobuf message. The 
message is successfully parsed, but I am not able to detect more than one 
element in a repeated field, even when multiple elements had been set.

Is there anything I am missing? Why would I not be able to parse all 
repeated elements?


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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to