title: Sending binary data over socket in c++
body: <p>In C++ I have data structure something like this:</p>
  
  <pre><code>struct Data 
  { 
  int N; 
  double R; 
  char Name[20];
  };
  </code></pre>
  
  <p>This Data I have to send over from a client to server on a different system (I have to send an array of Data structs, but i could send it just one by one). I would like to send it over as binary data, so that I could extract the data on the other end put it inside the same struct type. </p>
  
  <p>If both (client and sever) are compiled with the same compiler the sizeof(Data) and all bit paddings  within structure would be the same. But as server is 64bit running Linux and client could be even 32bit windows, the ordering of data within Data could be different. </p>
  
  <p>Am I Right? What would be the best way of dealing with this the problem?</p>