Serializing the packets
Serialization is a key feature to have in a networking system. The process of serialization involves converting a message or data to a format that can be transmitted over the network, and then decoding it. There are a variety of ways to serialize and deserialize data, and it comes down to a matter of personal choice.
Getting ready
You need to have a working Windows machine and Visual Studio. No other requirements are needed.
How to do it…
In this recipe, we will see how easy it is to serialize data. Create a source file and derive it from the serializer class:
using namespace xmls;
class LastUsedDocument: public Serializable
{
public:
LastUsedDocument();
xString Name;
xString Path;
xInt Size;
};
class DatabaseLogin: public Serializable
{
public:
DatabaseLogin();
xString HostName;
xInt Port;
xString User;
xString Password;
};
class SerialisationData: public Serializable
{
public:
SerialisationData();
xString Data1;
xString Data2;
xString Data3...