473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

reading in C++ a serialized object from .net

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.
Jul 21 '05 #1
4 1909
Hi,
I wrote an article entitled as A simple but handy utility for
serializing and de-serializing various data at the site
http://www.codeproject.com/csharp/uqueue.asp. It shows how to interop native
data types with managed data types. However, it doesn't work exactly like
the way you wanted. Wish it is helpful to you.
--
Yuancai (Charlie) Ye

Fast and securely accessing all of remote data sources anywhere with
SocketPro using batch/queue, asynchrony and parallel computation with online
compressing

See 30 well-tested and real OLEDB examples

www.udaparts.com
"bidou" <bi***@antisocial.com> wrote in message
news:88**************************@posting.google.c om...
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.

Jul 21 '05 #2
Hi,
I wrote an article entitled as A simple but handy utility for
serializing and de-serializing various data at the site
http://www.codeproject.com/csharp/uqueue.asp. It shows how to interop native
data types with managed data types. However, it doesn't work exactly like
the way you wanted. Wish it is helpful to you.
--
Yuancai (Charlie) Ye

Fast and securely accessing all of remote data sources anywhere with
SocketPro using batch/queue, asynchrony and parallel computation with online
compressing

See 30 well-tested and real OLEDB examples

www.udaparts.com
"bidou" <bi***@antisocial.com> wrote in message
news:88**************************@posting.google.c om...
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.

Jul 21 '05 #3
Hi,

you can take a look at mono project sources to see how serialization
works. Their implementation is compatible with .net's one in most areas.

Sunny

In article <88**************************@posting.google.com >,
bi***@antisocial.com says...
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.

Jul 21 '05 #4
Hi,

you can take a look at mono project sources to see how serialization
works. Their implementation is compatible with .net's one in most areas.

Sunny

In article <88**************************@posting.google.com >,
bi***@antisocial.com says...
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.

Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Russ | last post by:
Hi, What's the easiest way of modifying an object which has been serialized to a DB? The previous developer created a complex object hierarchy and binary serialized the whole thing to a single...
7
by: Jason Heyes | last post by:
I have a class with an expensive copy, read and write. There are many objects of this class used throughout my program. What kind of encapsulation of this class do I use to make sure copy, read and...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
2
by: Dennis C. Drumm | last post by:
Is there a way to open files with .net 1.1 versions of my software product that were serialized with a .net 2.0 version of same product? Right now, as soon as my older .net 1.1 application tries to...
5
by: EqDev | last post by:
I have a class that is a control derived from UserControl. I want to use serialization and deserialization with this calss but I get an exception "Cannot serialize member...
1
by: Phil Galey | last post by:
I'm using XMLSerializer in VB.NET to serialize class-based objects to XML. It's serializing fine, except that I don't seem to have control over the order in which the various fields (properties) of...
0
by: bharathreddy | last post by:
Before going to that i want to say few thing on serialization : Serialization is the process of converting an object into a form that can be readily transported. For example, you can serialize an...
8
by: Peter Bradley | last post by:
Hi, I wonder if anyone can help me out? I'm trying to implement an EPP (rfc4934 and rfc4930) client. So far I've managed to connect and authorise using an X509 Certificate. This should...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.