Java 和 .NET 3.5 之间进程间通信的最佳方法是什么?

发布于 2024-07-05 18:39:48 字数 245 浏览 4 评论 0原文

第三方应用程序从 XML 文件中读取一些 Java 代码,并在发生特定事件时运行它。 在 Java 中,我想告诉在同一台计算机上运行的 .NET 3.5 应用程序发生了此事件。 每次传输的总数据量大概就是几个字符。

使用 Java 告诉 .NET 进程发生了什么事的最佳方法是什么?

Java 似乎不支持 Windows 上的命名管道,.NET 本身并不支持内存映射,并且任何涉及 Web 服务或 RMI 的解决方案都是多余的。

A third-party application reads some Java code from an XML file, and runs it when a certain event happens. In Java, I want to tell a .NET 3.5 application, running on the same machine, that this event occurred. The total data transferred each time is probably a few characters.

What is the best way of using Java to tell the .NET process that something happened?

Java doesn't seem to support Named Pipes on Windows, .NET doesn't natively support memory-mapping, and any solution involving web services or RMI is overkill.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独难免 2024-07-12 18:39:48

如果您不希望 RMI 的全部开销,您可以通过打开端口并相互通信来在两者之间进行直接套接字通信。 您必须有某种方法让两个进程就使用哪些端口、如何握手等达成一致,但比 RMI 更简单。

ETA:看起来您可以使用来自java的命名管道,但您不能创建它们? 因此,如果 .NET 进程创建它,您可以使用 java 对其进行读/写。 Java只是将其视为文件?

If you don't want the full overhead of RMI, you could do direct socket communcation between the two by opening ports and talking to eachother. You'd have to have some way to have both processes agree on which ports to use, how to handshake/etc, but would be simpler than RMI.

ETA: it looks like you can use named pipes from java, you just can't create them? So if the .NET process would create it, you could read/write to it with java. Java just sees it as a file?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文