views:

584

answers:

4

I have two running processes in Windows, and each process has a pipe to the other.

I want to serialize a complicated class and transmit it from one process to the other. I already have the serialization procedure worked out, and I understand that the pipes are sending binary streams. How should I go about sending my serialized data? I'm using WinAPI and C++.

Should I develop a custom protocol? If so, should it be generic or unique to this particular class? Can I preserve virtual tables when sending the serialized class?

Are there any models or design patterns that are commonly used in this case? A little bit of sample code would be greatly appreciated. Thank you!

+2  A: 

You might want to check out protocol buffer.

ididak
+1  A: 

You can use boost::asio::windows::stream_handle to organize iostream like io, and do it asynchronously.

Lazin
+2  A: 

Here is the tutorial for boost::serialization. I could imagine it would work fine sending the data over the pipe and deserializing on the other side: http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/tutorial.html

Johannes Schaub - litb
+1  A: 

You don't have to worry about vtables since boost serialize is going to worry about types. The only thing you have to do is make sure that what ever type is serialize, then you use the EXACT SAME TYPE on the other side when de-serializing.

So there is not some 'common' model\protocol... For a say, few different classes?
bgee