C++ How can I send an object via socket?
问题 I have a question for you. I have this class: ` #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]; } ` 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); After that I open a connection between the client and the server using sockets. The question is: how can I send this object