Different versions of google protobuf work together?
Asked Answered
S

1

6

I'm writing a C++ client/server app. Server is built from VS 2015 while the client is built with VS 2010. Both are written in C++. I'm trying to use google's protobuf for serialization and parsing for data exchange between the server and client. VS 2015 works with codes generated with one version (3.5 in my case) of protobuf while VS 2010 works with another version (2.6.1 in my case). My question is: can data be serialized on one side and parsed on the other? I'm using identical .proto file on both sides. But have to use different versions of protobuf to generate the codes due to the aforementioned reasons.

Sunup answered 12/7, 2018 at 8:23 Comment(0)
C
4

Yes, the protobuf binary format is compatible between all library versions and languages.

Newer versions do add some new features (such as oneof fields and proto3 syntax), but if your .proto file compiles with the older version library, it is fully compatible.

Covey answered 13/7, 2018 at 13:20 Comment(1)
Thanks for the answer.Nice to know that it also works across different languages. I had bug in other places in my codes which lead me to believe there might be incompatibility between the different versions of probtobuf. No so, my code runs very smooth now. First time using protobuf is really a charm. Highly recommended for data exchange over the network. Hat off to Google!Sunup

© 2022 - 2024 — McMap. All rights reserved.