Java 和 .NET 3.5 之间进程间通信的最佳方法是什么?
第三方应用程序从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不希望 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?