Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the fastest IPC method for a .NET Program?

Tags:

c#

mono

ipc

Named Pipes ? XML-RPC ? Standard Input-Output ? Web Services ?

I would not use unsafe stuff like Shared Memory and similar

like image 419
TheQult Avatar asked Jan 04 '10 22:01

TheQult


2 Answers

Named pipes would be the fastest method, but it only works for communication between processes on the same computer. Named pipes communication doesn't go all the way down the network stack (because it only works for communication on the same computer) so it will always be faster.

Anonymous Pipes may only be used on the local machine. However, Named Pipes may traverse the network.

I left out Shared Memory since you specifically mentioned that you don't want to go that route. Shared Memory would be even faster than named pipes tho.

So it depends if you only need to communicate between processes on the same computer or different computers. Any XML-based communication protocol (eg. Web Services) will usually be slower due to the massive overhead in XML.

like image 61
Jaco Pretorius Avatar answered Nov 15 '22 20:11

Jaco Pretorius


Windows Messaging is one of the fastest ways for IPC, after-all Windows is built on them.

It's possible to use WM_COPYDATA with IPInvoke calls to exchange data between 2 form based .Net applications, and I've got an open source library for doing exactly that. I've bench marked around 1771 msg/sec on a fairly hot laptop.

http://thecodeking.github.com/XDMessaging.Net

like image 28
TheCodeKing Avatar answered Nov 15 '22 20:11

TheCodeKing