B
bidou
Hello World,
Using (unmanaged) C++ only, I'd like to be able to read a binary
stream coming from a .net object standard serialization. For example,
let's assume I have a .net client which serializes some "POD" objects
using the standard .net serialization mechanism, then writes them to a
network stream, and finally a C++ server receives this stream, reads
it and "interprets/deserializes" it, creating the corresponding C++
objects.
So, is there:
- any kind of specification of the .net binary format used when
serializing objects ?
- an existing implementation dealing with this issue ?
Ex:
=== Client side ===
[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
}
/* ... */
MyObject obj = new MyObject();
obj.n1 = 1;
obj.n2 = 24;
obj.str = "Some String";
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
formatter.Serialize(stream, obj);
stream.Close();
=== Server side (C++) ===
How do I read and interpret the "MyFile.bin" file ?
Thanks in advance.
Using (unmanaged) C++ only, I'd like to be able to read a binary
stream coming from a .net object standard serialization. For example,
let's assume I have a .net client which serializes some "POD" objects
using the standard .net serialization mechanism, then writes them to a
network stream, and finally a C++ server receives this stream, reads
it and "interprets/deserializes" it, creating the corresponding C++
objects.
So, is there:
- any kind of specification of the .net binary format used when
serializing objects ?
- an existing implementation dealing with this issue ?
Ex:
=== Client side ===
[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
}
/* ... */
MyObject obj = new MyObject();
obj.n1 = 1;
obj.n2 = 24;
obj.str = "Some String";
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create,
FileAccess.Write, FileShare.None);
formatter.Serialize(stream, obj);
stream.Close();
=== Server side (C++) ===
How do I read and interpret the "MyFile.bin" file ?
Thanks in advance.