title: Socket message header building
body: <p>I'm working on a protocol which will transfer block of xml data via tcp socket. Now say I need to read all the bytes from a xml file and build a memory buffer. Then before sending the actual data bytes I need to send one header to other peer end. Say my protocol using below header type. </p>
  
  <p>MessageID=100,Size=232,CRC=190</p>
  
  <pre><code>string strHeader = "100,232,190"
  </code></pre>
  
  <p>Now I would like to know how can I make this header length fixed (fixed header length is required for other peer to identify it as a header) for any amount of xml data. Currently say I'm having a xml file sized 283637bytes, so the message header will look like. </p>
  
  <pre><code>string strHeader = "100,283637,190"
  </code></pre>
  
  <p>How can I make it generic for any size of data? The code is being written both in c++ and c#. </p>