Question

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!

Was it helpful?

Solution

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

OTHER TIPS

You might want to check out protocol buffer.

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top