기초 - 객체 직렬화
2018. 9. 4. 19:55
직렬화를 왜 해야 하지? 가장 간단하게 어떤 객체를 네트워크를 통해 보내고 받는 방법은 다음과 같을 것이다 class SuperDog { public: SuperDog() : mHealth(10), mAge(0) { } private: int32_t mHealth; int32_t mAge; } void RecvDog(SOCKET sock, SuperDog* const dogPtr) { recv(sock, reinterpret_cast(dogPtr), sizeof(*dogPtr), 0); } void SendDog(SOCKET sock, const SuperDog* const dogPtr) { send(sock, reinterpret_cast(dogPtr), sizeof(*dogPtr), 0); } 하지만..