I have used IPC in win32 code a while ago. [Critical sections, events & semaphores]
How is the scene in .NET enviroment? Are there any tutorial explaining all available options and when to use and why?
I have used IPC in win32 code a while ago. [Critical sections, events & semaphores]
How is the scene in .NET enviroment? Are there any tutorial explaining all available options and when to use and why?
Most recent Microsoft's stuff in IPC is Windows Communication Foundation. Actually there is nothing new in the lower level (tcp, upd, named pipes etc) But WCF simplifies IPC development greatly.
Useful resource:
and of course MSDN on WCF
There is also .NET Remoting, which I found quite cool, but I guess they are obsoleting it now that they have WCF.
I tend to use named pipes or Unix sockets (depending on whether I'm targetting MS.NET or Mono -- I have a class that abstracts it away) since it's easy to use, portable, and allows me to easily interoperate with unmanaged code. That said, if you're only dealing with managed code, go with WCF or remoting -- the latter if you need Mono support, since their WCF support simply isn't there yet.
It sounds as though you're interested in synchronization techniques rather than communication. If so, you might like to start here, or perhaps this more concise overview.
HTH, Kent
C# has language support for critical sections via the lock statement:
private object syncObject = new object();
public void foo()
{
lock (syncObject)
{
do stuff...
}
}
The .NET framework also supports events and semaphores via classes in the System.Threading namespace. They are usually anonymous, but may be named and secured for inter-process synchronization. Events are easier to use than their Win32 counterparts, mainly because the "auto reset" and "manual reset" flavors are expressed in different classes (aptly named AutoResetEvent and ManualResetEvent, respectively).