The task is to develop a protocol for notification of two devices. Both devices are connected to each other via a network (Ethernet). On one Linux device, on another Real-time OS. You need to create a protocol by which devices will notify each other about events. The implementation is scheduled on C over TCP / IP.

At the moment, the choice is:

  • own format
  • XML or JSON,
  • Protocol buffers.

The question is that

  1. easier to use
  2. easier to support, develop,
  3. easier to implement?
  • one
    As an option - JSON, though, if it's not about http, it's not the best solution, I'm not talking about XML at all :) - Zowie
  • If the events are independent and simple (there is little data associated with the event and the data structure is simple), then its own protocol is better. Less hassle. - avp
  • 2
    ASN.1 forgot. It is, of course, in places, for aliens, but, nevertheless. - drdaeman

4 answers 4

My subjective assessment:

Protocol Buffers :

  • Supported by Google for internal services
  • A bunch of ready-made implementations
  • Portable cross-platform format
  • Binary format (result - small message size)


  • Terribly overweight
  • Parse quick

Json :

  • Takes less than XML
  • By itself, easier - easier and faster to parse

My selection in order of priority:

  1. Protocol buffers
  2. Json
  3. XML

In any case, I would not write the implementation of any of the formats from scratch.

In addition to all the drawbacks / pluses marked with @eigenein, I would put 1 plus in the direction of JSON if you put it in a text format, which makes debugging much easier. Protocol Buffers format is binary and in which case it will be difficult to debug.

Well, XML - alas, does not roll under any sauce: excess, slow, cumbersome and all that.

My personal choice is for JSON.

PS Do not write your own!

    As an option, also consider Thrift.

      In this simplest case (only two devices) there is no difference. But I wouldn't use XML anyway. He is already too old. It is time for him to retire. Worse than it, just inventing your own format.