tags:

views:

8625

answers:

5

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?

+11  A: 

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

aku
A: 

There is also .NET Remoting, which I found quite cool, but I guess they are obsoleting it now that they have WCF.

ionut bizau
Has Microsoft ever actually said that?
Mark
No idea. It's just my guess.
ionut bizau
They have: "This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF)." from http://msdn.microsoft.com/en-us/library/kwdt6w2k.aspx
Lucas
+4  A: 

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.

Cody Brocious
+2  A: 

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

Kent Boogaart
A: 

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).

Paul Lalonde