communication between Java and C#

£可爱£侵袭症+ 提交于 2019-12-06 11:23:49

XMPP isn't what you want. It's designed for passing messages between computers with a central server.

I'd recommend using sockets to pass data between the apps. See the System.Net.Sockets.Socket class in C# and the java.net.Socket class in Java.

Where I work we use ICE (http://www.zeroc.com/). It lets us marshal binary data between java and C#. It's not bad.

Google's Protocol Buffers might be a option. It's very portable and quite fast.

Responding to the OP's "answer" ...

The way to map "server push" onto the classical RPC model (e.g. as implemented by CORBA, SOAP, ICE, RMI, and so on) is to flip the role so that the thing you think of as your server fills the client role in the RPC. The pattern is like this:

  1. Your client makes a call to your server, passing the handle for a callback object.

  2. The server remembers the callback object and returns.

  3. The client goes to sleep (or does something else ...)

Later on, the server wants to push some data.

  1. The server invokes the "push" RPC on the callback object, passing the data.

  2. The client receives the call/request on the callback object, does something with the data, and replies.

If I were doing this, and needed low-latency, I might consider a memory-mapped file, or a pipe. Either of these would require some JNI and p/invoke programming.

If performance is important, see what's used in scientific computing. Scientists have the same sort of problems seen in enterprises, needing to connect clients and servers and all that, in an even wider range of languages and platforms. Perhaps this component tie-together tool called Babel would be useful beyond its original domain? Interfaces are described by SIDL (like IDL in CORBA) but I don't know if C# is covered yet. https://computation.llnl.gov/casc/components/babel.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!