How to implement protocol buffers (de)serialization on a Java client talking to a .NET server utilizing protobuf-net v2?

久未见 提交于 2019-12-12 19:12:24

问题


If I understand it correctly, the Java end needs the respective .proto file. However, it is unclear to me how to generate one from the RuntimeTypeModel instance (protobuf-net v2) used on the server side.

Thanks.


回答1:


At current, it simply hasn't been re-written; there is a v1 version of GetProto(), however it won't apply to v2 as it needs to be heavily refactored to work from RuntimeTypeModel. It is simply a case of finding time to put the code together.

If the model is moderately sized, I can probably help hook it together manually.

Note also that protobuf-net offers some features that will not map very nicely into .proto, since they have no definition at all in core .proto (these are usually clearly documented as extension), such as:

  • reference tracking
  • inheritance
  • dynamic types

Additionally, some of the BCL core types do not have direct .proto counterparts, including:

  • Guid
  • DateTime
  • TimeSpan

these can be interpreted, but require a little more shuffling



来源:https://stackoverflow.com/questions/7329553/how-to-implement-protocol-buffers-deserialization-on-a-java-client-talking-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!