2

I am currently integrating a server functionality into a software that runs a complicated measuring system. The client will be a software from another company that will periodically ask my software for the current state of the system.

Now my question is: What is the best way to design the protocol to provide these state information. There are many different states that have to be transmitted.

I have seen solutions where they generate a different state flags and then only transfer for example a 32 bit number where each bit stands for a different state.

Example:

  • Bit 0 - System Is online
  • Bit 1 - Measurement in Progress
  • Bit 2 - Temperature stabilized ... and so on.

This solution will produce very little traffic. Though it seems very unflexible to me and also very hard to debug.

The other I think it could be done is to tranfer each state preceded by the name of the state:

Example: #SystemOnline#1#MeasurementInProgress#0#TemperatureInProgress#0#.....

This solution will produce a lot more traffic. But it appears a lot more flexible because the order in which each state is tranfered irrelevant. Also it should be a lot easier to debug.

Does anybody knows from experience a good way to solve the problem, or does anybody know a good source of knowledge where I can find best practices. I just want to prevent trying to reinvent the wheel

Michael Küller
  • 3,982
  • 4
  • 22
  • 42

1 Answers1

0

Once you've made a network request to a remote system, waited for the response, and received and decoded the response, it hardly matters whether the response is 32 bits or 32K. And how many times a second will you be generating this traffic? If less than 1, it matters even less. So use whatever is easiest to implement and most natural for the client, be it a string, or XML.

Tim Rogers
  • 21,297
  • 6
  • 52
  • 68