Link to home
Start Free TrialLog in
Avatar of danace
danaceFlag for Singapore

asked on

Which is fastest interprocess communication(WM_COPYDATA vs Winsock vs .NET Remoting)

Which is fastest interprocess communication and easy to implement (WM_COPYDATA vs Winsock vs .NET Remoting)
*I tried researching on Enterprise Services but there are very limited resources and samples to look at.

it will be implemented in the same machine(using Vista) as of now
but has a chance to transfer it to different machines in the future.
For Winsock, i think it is same as using TCPListener/tcpclient(correct me if i am wrong)
so maybe this is more easier and it is managed code
Avatar of drichards
drichards

I'd look at named pipes if you are using  latest .NET (http://msdn.microsoft.com/en-us/library/system.io.pipes.aspx and http://msdn.microsoft.com/en-us/library/bb762927.aspx).  Faster than TCP on same machine and named pipes can also be used across machines.

If you use WCF you can configure which transport is used (HTTP, TCP, named pipes).
Avatar of danace

ASKER

Thanks for the comment but when pipes is used across machines, the performance might suffer based on what i have read(http://msdn.microsoft.com/en-us/library/ms187892.aspx). That is why I didn't included pipes as my choice. As of now I am trying to find something that perfoms best either in the same or across machines.

I think implementing WCF may take time in implementing because i need to study it from scratch..
is there other recommendations?
Since I don't know anything about your app, I cannot recommend what would be best.  I can only say that pipes are much better between local processes, which is your first target.  They are also not bad on a decent network with reasonable data volumes.  They are not best for high-volume server apps.

WCF, while it does have a learning curve, is also very powerful if your app needs the flexibility.

Otherwise, TCP is a solid choice and reasonably straightforward to implement.
Even the MS article you refernce concedes that:

"Generally, TCP/IP is preferred in a slow LAN, WAN, or dial-up network, whereas named pipes can be a better choice when network speed is not the issue, as it offers more functionality, ease of use, and configuration options."

That does not sound like a compelling argument to avoid pipes just because a network is involved.

But again, you know the requirements of your app and I do not.  I just now I have used pipes quite successfully.  I have also used TCP and even UDP quite successfully, and the right choice does depend on the exact nature of the application.
Avatar of danace

ASKER

I am developing a multithreaded client-server application(running Vista) which communicates via HTTP Request using HTTPListener/HTTPWebRequest. The server(which is the focus of my question) will be having different modules. I want these modules to communicate with each other using the fastest IPC but I can't figure out which of them are best in terms of speed. These modules reside in the same machine and be in different machines in the future.

I am really confused between those IPC mechanisms, and don't know which would be the best for me to use. Is named pipes still your recommendation for my application? How about remoting?
I think you're probably needlessly confused.  You can probably use any of:

1) Named Pipes
2) TCP
3) TCP remoting
4) WCF configured for named pipes within the machine and TCP for remote operation

with success.  I'd start with the one you are most confortable with and check performance.  Remotring and WCF are only options if you are communicating via .NET objects.  If you've got some custom protocol that you want or need to use then you've got to do that yourself over a pipe or socket.
Avatar of danace

ASKER

Thanks for the help, i will try to check out on these named pipes first.
But still not so satisfied with the solution though..I also found out about the Named pipe version .Net Remoting using Channel.Ipc...have any idea on it?
ASKER CERTIFIED SOLUTION
Avatar of drichards
drichards

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danace

ASKER

Ok thank you for the suggestion regarding WCF.I may consider it.

Overall, thanks for the answers. It is very well explained.
Avatar of danace

ASKER

Very Nice! Thanks for the help!