all groups > dotnet remoting > may 2005 >
You're in the

dotnet remoting

group:

Need to fill gaps for creating a remotable singleton


Need to fill gaps for creating a remotable singleton sethlivingston NO[at]SPAM gmail.com
5/23/2005 12:19:45 PM
dotnet remoting:
Hi,

I've poured throught the MSDN documention on remoting; I'm close to
getting things working, but I need to fill in some gaps. Here's what I
need:

1. Remotable Controller class in MySystemTray.exe must be a singleton.
It controls the icon in the system tray and a Windows Form that you can
view by double-clicking the icon in the system tray.

2. Clients must be able to access that instance to show or hide the
Windows Form, or to ask MySystemTray.exe to exit.

3. We have to let the system choose the tcp port; we can't hard-code a
specific port. We can use named ports, though.

Controller class implements IController from a shared DLL and inherits
from MarshalByRef; by itself, it works fine.

So my question is this: What does the .config file on MySystemTray.exe
look like, and what does the .config file (and C# code) on MyClient.exe
look like?

I've tried new, .GetObject, and .CreateInstanceFrom, and none of them
produce the results I'm looking for. Figuring out how to use a system
chosen (albeit named) port has also been difficult--you can't get a URI
from IChannel.

Thanks!
Re: Need to fill gaps for creating a remotable singleton sethlivingston NO[at]SPAM gmail.com
5/25/2005 9:19:17 AM
[quoted text, click to view]
just isn't a true singleton if you're talking about two different
processes talking to each other. I ended up using
RegisterWindowMessage() and PostMessage() instead, even though it was
somewhat of a messy solution.
AddThis Social Bookmark Button