关于设计选择 [英] Regarding the design choices
本文介绍了关于设计选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
首先,"Managed C ++"已由您标记的C ++/CLI取代,因此这几乎不是一个选择.其他所有内容实际上都取决于您的要求的详细信息,甚至取决于您对技术的熟悉程度.在这种情况下,无法证明仅使用此内容,别无其他"类型的任何建议.
不幸的是,WCF的非托管部分(旧版MFC应用程序)对我来说似乎太麻烦了,请参阅 ^ ].
插座还是命名管道?两者似乎都合理.我认为,使用Socket可以更轻松地编写更多可移植的代码.
—SA
WCF
在我看来,用非托管的C ++编写WCF的主机实现似乎有些麻烦.
插座
这是一个选择,但是我从来没有真正使用过它们,所以我不知道它是多么可行.这就是说,如果您需要与Java之类的东西通信,而您不能使用命名管道.
命名管道
如果您使用的是.NET 3.5或更高版本,因为在.NET 3.5之前没有引入命名管道,那么我会使用这一名称.请注意,如果您打算使用Mono,那么我不确定Mono是否实现了命名管道.
MSMQ
也是一种选择,尽管我想这对您来说不是一个好选择,但却不完全知道您想做什么.
如果您想赶紧完成工作-使用 COM互操作 [ 解决方案
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
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.
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
这篇关于关于设计选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文