我尝试将protobuf-c消息附加到TLV中的值,并通过网络发送它。但是我在数据包转储中看不到正确的内容。下面是tlv结构和.proto文件。
struct test_tlv {
unsigned int type;
unsigned int len;
unsigned int val;
};
message testproto
{
optional uint32 type=1;
optional string id =2;
}以test.type= 2 and test.id="0xabcdbcda";格式填充消息值
我已经使用protobuf api将测试打包到val中并通过网络发送tlv,但我在转储的数据包中看不到正确的值。我错过了什么吗?
发布于 2012-08-21 22:56:40
因为消息是用varint编码的,所以我假设这些值是错误的。解码后,这些值看起来是正确的。
https://stackoverflow.com/questions/11897076
复制相似问题