Serialize in Java then deserialize in C++?
<p>I have a java program that will send(over TCP) packets to a c++ program. Only two types of objects will be sent (struct A or struct B). I need to serialize the two objects and send them to the c++ program, such that when de-serialized inside the c++ program they will be of the type struct A or struct B, depending on what has been sent. How can I achieve this without any external java packages?</p>

<pre><code>            struct A
            {
                unsigned int field1; 
                unsigned int field2; 
            }

            struct B
            {
                unsigned int length;
                struct A list[GLOBALLENGTH];
            }
</code></pre>

<p>GLOBALLENGTH is a static and globel int.</p>

<p>Please note that I dont need a general solution, as I will strictly be dealing with the mentioned types above. Also, I dont have access to the c++ program(it is a blackbox), both operate in little indian. </p>
