views:

50

answers:

3

I'm looking for a way to ease the difficulty transferring data from one application/process to another.

It's said to be better than UDP or TCP for communicating by processes in the same OS(windows xp here) .

Can you provide some core code that illustrate this?

+1  A: 

take a look at boost.Interprocess to get an easy way to do communication

Anders K.
+1  A: 

Well, yes, COM supports remote procedure calls to an out-of-process COM server. You make the call from the client, it runs in another process as though it was called inside that process. A code snippet doesn't make much sense because it looks exactly like a regular function call.

There's a fair amount of plumbing and configuration you have to take care of to make that work. You typically need a proxy/stub DLL that helps to marshal the arguments of the function call. They are normally auto-generated from the IDL you write that describes the interfaces. If the arguments you pass are 'unusual' then you may need to write a custom marshaller. That's usually easily avoided by not passing opaque pointers or variable sized chunks of data.

Visual Studio can get a lot of that stuff done automatically, ATL is very helpful. Doing something wrong unintentionally is definitely a lot harder to trouble-shoot. Expect several months to get up to speed on this if you've never done it before. Getting good learning material can be difficult, this is getting obsolete. This kind of stuff is done in managed environments these days. Much easier to auto-generate the required proxies.

Hans Passant
+1  A: 

In my project I decided to use named pipes for inter-process communication.

AOI Karasu
What's the benifit to use overlapped mode?
"Overlapped operations make it possible for one pipe to read and write data simultaneously and for a single thread to perform simultaneous I/O operations on multiple pipe handles. This enables a single-threaded pipe server to handle communications with multiple pipe clients efficiently."
AOI Karasu
So in Overlapped mode Read/Write operations returns immediately,right?
wamp