title: C++ How can I send an object via socket?
body: <p>I have a question for you.</p>
  
  <p>I have this class:</p>
  
  <p>`</p>
  
  <pre><code>#define DIMBLOCK 128
  #ifndef _BLOCCO_
  #define _BLOCCO_
  
  class blocco
  {
      public:
          int ID;
          char* data;
  
  
          blocco(int id);
  };
  
  #endif
  
  
  
  
  blocco::blocco(int id)
  {
      ID = id;
      data = new char[DIMBLOCK];
  }
  </code></pre>
  
  <p>`</p>
  
  <p>and the application has a client and a server.
  In the main of my server I instantiate an object of this class in this way:
  blocco a(1);</p>
  
  <p>After that I open a connection between the client and the server using sockets.
  The question is: how can I send this object from the server to the client or viceversa?
  Could you help me please?</p>