Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++/CLI C# .NET Managed , +
I'm required to design the bidirectional distributed communication between legacy (MFC based VC++ application) and .NET GUI application (going to be built in C#). I have considered several approaches like Managed C++ (IJW), WCF (as a framework for communciations), Sockets, Named Pipes. Please suggest.
Posted 18-Oct-11 10:23am
Comments
SAKryukov at 18-Oct-11 15:43pm
   
Same machine or network?
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

First, "Managed C++" was superseded by C++/CLI which you tag, so this is hardly an option. Everything else really depends on details of your requirements and even of the level you are familiar with the technologies. In this case, it's not possible to justify any advice of the type "use just this, nothing else".
 
Unfortunately, WCF for unmanaged part (legacy MFC application) seems too much of a hassle to me, see http://stackoverflow.com/questions/686452/create-wcf-service-for-unmanaged-c-clients[^].
 
Sockets or Named Pipes? Both seem reasonable. I think, with Sockets its somewhat easier to write more portable code.
 
—SA
  Permalink  
Comments
Simon Bang Terkildsen at 18-Oct-11 16:00pm
   
My 5. That's an interesting link, I thought of implementing WCF in C++ as a hassle, I might change my mind after reading it all.
SAKryukov at 18-Oct-11 17:01pm
   
Thank you, Simon.
You probably mean native Win32 development.
Well, yes, even though I put this link to confirm my view at all this as a hassle, the advice in the article shows that this is not so much of a hassle as I would think before.
--SA
sundararaman at 18-Oct-11 16:10pm
   
Thanks for your suggestions. I thought the same, but I'm thinking of a design solution that will provide you the following facilities.
1. Future is .NET. so Gradually my solution helps the legacy code to be converted into .NET.
2. if I have a WCF kind of communication framework, in future communication can be changed from one option to other like tcp to named pipes and so on.
 

Regards,
Sundar
SAKryukov at 18-Oct-11 17:04pm
   
This is true. With WCF, you only change channels which are very independent from other aspects of communication. If this is an important priority for your project as well, it would be a huge plus in favor of WCF. And if you plan to get rid of native C++ part in future, this is an apparent benefit.
--SA
Espen Harlinn at 18-Oct-11 19:20pm
   
5'ed!
SAKryukov at 18-Oct-11 19:58pm
   
Thank you, Espen.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

WCF
Seems lake a hassle, to me, to write a host implementation of WCF in unmanaged C++.
 
Sockets
This is an option, however I've never really used them so I don't know how feasible it is. That said if you need to communicate with something like Java where you can't use Named Pipes.
 
Named Pipes
I would go with this one, if you're using .NET 3.5 or above as Named pipes wasn't introduced before .NET 3.5 . Note if you intend on using Mono then I'm not sure if Mono even implements Named Pipes.
 
MSMQ
Is also an option, though I guess that it is not a good one in your case, without knowing exactly what you want to do.
  Permalink  
Comments
Espen Harlinn at 18-Oct-11 19:21pm
   
5'ed!
Simon Bang Terkildsen at 19-Oct-11 11:23am
   
Thank you, Espen.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If you want to get the job done in a hurry - use COM Interop[^]
 
.Net has great support for COM, and COM enabling an MFC app is usually a straight forward process.
 
Best regards
Espen Harlinn
  Permalink  
Comments
sundararaman at 19-Oct-11 9:13am
   
Thanks Espen. But I want to know how far COM interop can be used for distributed communication. I guess it will be very complex. My MFC application sits on one machine and my .NET GUI application sits on the other machine.
Espen Harlinn at 19-Oct-11 14:01pm
   
That shouldn't be a problem ... DCOM (Distrbuted COM) is based on DCE RPC. You just have to make sure things don't get blocked by firewall, and that DCOM is configured correctly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 280
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 120
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 18 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100