Interprocess communication in .NET

S

Sahil Malik

Allright the title seems to say it all.

What is the best way to implement interprocess communication in .NET. Sorry
remoting is not the answer because simply it has too much goo of network
layer before processes on the same machine get to communicate.

I remember in COM there used to be an ActiveX EXE, or a windows service with
a COM interface ..

How would one do the same in .NET?

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik
 
P

Parco

use Visual Studio .NET to create a testing project, and call the COM object
to be one of its references, then VS.NET will create a managed object
assembly from that COM object for you.
 
D

David Browne

Sahil Malik said:
Allright the title seems to say it all.

What is the best way to implement interprocess communication in .NET.
Sorry remoting is not the answer because simply it has too much goo of
network layer before processes on the same machine get to communicate.

I wouldn't try to use COM, since that would introduce all the "goo" of COM
interop.

If you don't like remoting, and you are looking to implement an
application-level communications protocol, you can just build it on top of
System.IO.Stream. Then you can use either the NetworkStream implementation,
or if TCP/IP has too much "goo", you can use CreateNamedPipe, OpenNamedPipe
and System.IO.FileStream(IntPtr) to wrap a FileStream around a NamedPipe.
Pipes use shared memory for interprocess communication; so it's very fast.

So the communication would look like:


Application 1
 
R

Richard Blewett [DevelopMentor]

Well, FileStream, etc all use interop to talk to the underlying OS, but its not COM. Another alternative would be to use shared memory. I wrote a wrapper for shared memory some time ago

http://staff.develop.com/richardb/weblog/permalink.aspx/32c3abfb-bac9-4e19-bbc5-39ca338d906d

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Hmm .. I like this solution. Especially because it's 100% managed.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
S

Sahil Malik

Well that's true, but there is a certain sense of safety I feel when using
prebuilt .net classes and limiting myself to those.
The shared memory solution is awesome too. There should be an application
block around this problem frankly.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 
R

Richard Blewett [DevelopMentor]

I have a feeling one of the application blocks does have something along these lines (possible the caching one)

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Well that's true, but there is a certain sense of safety I feel when using
prebuilt .net classes and limiting myself to those.
The shared memory solution is awesome too. There should be an application
block around this problem frankly.

- Sahil Malik
You can reach me thru my blog http://www.dotnetjunkies.com/weblog/sahilmalik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top