background preloader

Protobuf

Facebook Twitter

Difference in .NET Protocol Buffer libraries. Protobuf - Protocol Buffers - Google's data interchange format. What is it?

protobuf - Protocol Buffers - Google's data interchange format

Protocol Buffers are a way of encoding structured data in an efficient yet extensible format. Google uses Protocol Buffers for almost all of its internal RPC protocols and file formats. Latest Updates Documentation Read the documentation. Discussion Visit the discussion group. Quick Example You write a .proto file like this: message Person { required int32 id = 1; required string name = 2; optional string email = 3;} Then you compile it with protoc, the protocol buffer compiler, to produce code in C++, Java, or Python. Then, if you are using C++, you use that code like this: Person person;person.set_id(123);person.set_name("Bob");person.set_email("bob@example.com"); fstream out("person.pb", ios::out | ios::binary | ios::trunc);person.SerializeToOstream(&out);out.close(); Or like this: Person person;fstream in("person.pb", ios::in | ios::binary);if (!

For a more complete example, see the tutorials. Protobuf-net - Fast, portable, binary serialization for .NET. Introduction protocol buffers is the name of the binary serialization format used by Google for much of their data communications.

protobuf-net - Fast, portable, binary serialization for .NET

It is designed to be: small in size - efficient data storage (far smaller than xml) cheap to process - both at the client and server platform independent - portable between different programming architectures extensible - to add new data to old messages protobuf-net is a .NET implementation of this, allowing you to serialize your .NET objects efficiently and easily. It is compatible with most of the .NET family, including .NET 2.0/3.0/3.5, .NET CF 2.0/3.5, Mono 2.x, Silverlight 2, etc. The short version (see also the old home page) Serialization is a pain. protobuf-net is designed to be easily used on your existing code with minimal changes (of from an optional .proto schema), enabling fast and portable binary serialization on a wide range of .NET platforms. // write to a fileSerializer.Serialize(outputStream, person); "v2" released. Protobuf-remote - RPC implementation for C# and C++ using Protocol Buffers.

Protobuf-csharp-port - Google's Protocol Buffers project, ported to C# "Protocol Buffers" is a binary serialization format and technology, released to the open source community by Google in 2008.

protobuf-csharp-port - Google's Protocol Buffers project, ported to C#

There are various implementations of Protocol Buffers in .NET. This project is a fairly close port of the Google Java implementation. There are two main parts: ProtoGen.exe, which takes binary representations of protocol buffer descriptors (as generated by the "stock" protoc binary supplied by Google) and creates C# source code.

This is only required at build time. Google.ProtocolBuffers.dll, which is a supporting library. As of April 2011, all development for this project will be performed in the Google Code Mercurial repository; the old GitHub project is obsolete. There is API documentation available here, which can also be downloaded as a CHM file.