Re: [protobuf] How to determine if the input is malformed? (C++, MessageLite::ParseFromCodedStream)

已查看 141 次
跳至第一个未读帖子

Christopher Head

未读,
2012年9月12日 14:38:222012/9/12
收件人 prot...@googlegroups.com

Protobuf messages do not have inherent delimiters; in fact, the concatenation of two messages can sometimes be a perfectly valid single message. Add delimiters in your protocol (if you are only sending a single message then just shutdown() the socket afterwards and have the recipient read until EOF; otherwise, send the length of the message in front of the message itself).

Chris

On Sep 12, 2012 8:37 AM, "iz" <izf...@gmail.com> wrote:

iz

未读,
2012年9月13日 03:02:522012/9/13
收件人 prot...@googlegroups.com
Thanks, Chris! I understood. Using the message length is the only simple solution for this issue.

среда, 12 сентября 2012 г., 22:38:25 UTC+4 пользователь Christopher Head написал:
回复全部
回复作者
转发
0 个新帖子