[.net] Interproces communication and singleton

Started by
2 comments, last by Eric_B 19 years, 6 months ago
My applications needs to share data among each other. In COM singleton does the job, but in .Net singleton isn't sharing data between different applications. How do I do this? I can use .Net remoting but I don't like to use it for IPC with apps running on the same machine.
Advertisement
I may be wrong here, but I believe that .NET Remoting is the promoted way to do IPC by Microsoft. It really depends on what kinds of "applications" they are. If one program is really just a "helper" program, the other program can load and run the other program within itself (by loading it up in a different appDomain). Then you can use some methods on the AppDomain class for inter-AppDomain communication. I would say go with .NET Remoting though.

If you just want to share data, you could probably also do it via MSMQ and messaging. Or if you are feeling very "hacker"-like, you can hook into the windows messaging pump and do it via windows messages.

I also suppose you could do it via Web Services but for interprocess communication on the same box, Web Services are way overkill, imo.

I would say go with .NET Remoting. Not only will you be able to share data, but you could even share objects between applications. Of course, if you are sharing a *lot* of data, you might want to be aware of any possible serialization issues.
Jason Olson - Software Developer[ Managed World ]
I agree that remoting is normally the best way to go. Given that you don't give more information it's hard to give better advise. Why are you sharing data? What data? How much data are we talking about? How frequently does it need updates? What can you tell about the applications sharing data? 1-1 relationship? Several applications? etc. etc.
Quote:
Why are you sharing data? What data? How much data are we talking about? How frequently does it need updates? What can you tell about the applications sharing data?


I think sharing memory among all instances is the solution. It is easy to do in COM, but I don't like to use COM with managed code.

This application loads and manipulates data from a local xml file. Normally users won't run more than 1 instance, but I like to add protection against this kind of problems. I've 3 choices.

1. Limit users to one instance only.

or

2. If a record is open in one instance, don't allow to open the same record in another instance.

or

3. Send a message to all open windows to update their content.

This topic is closed to new replies.

Advertisement