C ++应用程序和Java应用程序之间的进程间通信在Windows操作系统环境中 [英] Interprocess Communication between C++ app and Java App in Windows OS environment

查看:406
本文介绍了C ++应用程序和Java应用程序之间的进程间通信在Windows操作系统环境中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Windows上有一个启动Java进程的C ++应用程序。这两个应用程序需要彼此通信(通过xml的片段)。



您将选择什么进程间通信方法,为什么?



我们的表上的方法是:共享文件,管道和套接字(虽然我认为这有一些安全问题)。

解决方案

我不知道为什么你认为基于套接字的通信会有安全问题使用SSL)。这通常是一个非常好的方法,因为它是语言不可知,假设您有一个明确定义的通信协议。请查看Google的协议缓冲区 ,例如 - 它们生成所需的Java类和流。



根据我的经验,文件系统(特别是网络文件系统)不太适合这样的通信,因为它们不一定调试

另一个选项是 消息层(例如 AMQ 或Tibco),尽管这可能需要更多的管理开销(加上专业知识)来设置。



就我个人而言,我会选择纯插座方法,因为它的灵活性和简单性。您将完全控制


We have a C++ application on Windows that starts a java process. These two apps need to communicate with each other (via snippets of xml).

What interprocess communication method would you choose, and why?

Methods on the table for us are: a shared file(s), pipes and sockets (although I think this has some security concerns). I'm open to other methods.

解决方案

I'm not sure why you think socket-based communication would have security concerns (use SSL). It is often a very good approach as it is language agnostic, assuming that you have a well-defined communication protocol. Have a look at Google's protocol buffers, for example - they generate the required Java classes and streams.

In my experience, file systems (especially network file systems) are not well suited to such communication as they are not necessarily tuned for messaging (I've seen caching issues result in files being not picked up by the target process for example).

Another option is a messaging layer (AMQ or Tibco for example) although this will likely involve a greater administrative overhead (plus expertise) to set up.

Personally I would opt for a pure-socket approach because of its flexibility and simplicity. You will be in complete control.

这篇关于C ++应用程序和Java应用程序之间的进程间通信在Windows操作系统环境中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆