Jump to content
  • Advertisement
Sign in to follow this  
Eric_B

[.net] Interproces communication and singleton

This topic is 5408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!