简体   繁体   English

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

[英]What is the best method of inter-process communication between Java and .NET 3.5?

A third-party application reads some Java code from an XML file, and runs it when a certain event happens. 第三方应用程序从XML文件中读取一些Java代码,并在发生特定事件时运行它。 In Java, I want to tell a .NET 3.5 application, running on the same machine, that this event occurred. 在Java中,我想告诉在同一台机器上运行的.NET 3.5应用程序发生了这个事件。 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告诉.NET进程发生了什么事情的最佳方法是什么?

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. Java似乎不支持Windows上的命名管道,.NET本身不支持内存映射,任何涉及Web服务或RMI的解决方案都是过度的。

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. 如果你不想要RMI的全部开销,你可以通过打开端口和彼此交谈来直接在两者之间进行套接字通信。 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. 您必须有一些方法让两个进程就使用哪些端口,如何握手/等达成一致,但是比RMI更简单。

ETA: it looks like you can use named pipes from java, you just can't create them? ETA:看起来你可以使用 java中的命名管道,你只是无法创建它们? So if the .NET process would create it, you could read/write to it with java. 因此,如果.NET进程创建它,您可以使用java读/写它。 Java just sees it as a file? Java只是将其视为文件?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM