In Search Of... Robust, Secure IPC for .NET

In the latest issue of Windows Developer Magazine, I relate my experience and frustrations trying to find a safe, robust IPC story somewhere in the .NET Framework.  Included: a managed wrapper for DDE (both client- and server-sides of the conversaton).  Yeah, that's right -- I said "DDE".  You know, Dynamic Data Exchange?  Like, what the Windows shell uses to communicate with Visual Studio .NET, when you double-click on a .cs file?!

DDE is still a great choice for simple, safe intra-session IPC.  If your app already has a windows message-pump, sending and recieving DDE messages doesn't incur any extra overhead, really.

But DDE was designed for passing small messages -- commands and filenames, and the like.  Its internal implementation involves a lot of memory-copying, so it bogs down under heavy load.  For messages larger than, say a megabyte, using a shared memory segment (a.k.a. file mapping) is a better approach.  Several good-looking wrappers for shared memory exist -- I regret I didn't have the time or space to talk about them, in the article.  But I really like the look of Richard Blewett's work.  Also worth checking out are Natty Gur's article on codeproject.com, which includes a thorough tour of the underlying file-mapping API, and Ren Grob's user sample on GotDotNet, which seems to be a more fine-grained approach to wrapping that API.

Happy IPC'ing!