[Mono-list] Simple Interprocess Communication?

Robert Jordan robertj at gmx.net
Wed Jan 28 12:11:31 EST 2009


Sascha Leib wrote:
> Hello all,
> 
> sorry if this has been asked before.
> 
> What is the cleanest (read: platform-independentest :-) way to communicate
> with another instance of the same program.
> 
> What I want to achieve is the following: my app can handle multiple windows,
> so when the user re-launches another instance of the application, it should
> just notify the already running instance to open a new window, and exit
> (that is, unless he uses a specific command line switch, but that's another
> story...)

If your app is targeting .NET 2.0 you may want to look at 
System.Threading.Semaphore or System.Threading.Mutex.

Both allow the creation of system wide objects (see the
ctors with a string argument) on which you can call
.Wait/WaitOne() to wait (preferably on a separate thread)
until the object is signaled by the consecutive instance of
your app.

Robert



More information about the Mono-list mailing list