简体   繁体   English

C ++和Java对象通信

[英]C++ and Java objects communication

I need to establish a communication model between C++ layer and Java layer in my application. 我需要在我的应用程序中建立C ++层和Java层之间的通信模型。 Initially, I planned to use SOAP with XML, but my clients are interested in setting up a database communication channel. 最初,我计划使用SOAP with XML,但我的客户对建立数据库通信渠道感兴趣。

I am new to DB and not sure how to proceed. 我是DB的新手,不知道如何继续。 I would like to take your sincere suggestions on the implementation of communication in terms of objects between C++ and Java layer using database. 我想就使用数据库在C ++和Java层之间的对象实现通信方面提出真诚的建议。

Thanks, Geet 谢谢,Geet

Database as communication? 数据库作为通信? shudder 不寒而栗

http://en.wikipedia.org/wiki/Database-as-IPC http://en.wikipedia.org/wiki/Database-as-IPC

This is an anti-pattern. 这是一种反模式。 Can you change your clients' minds? 你能改变客户的想法吗?

Sockets are easier than a full blown SOAP interface. 套接字比完整的SOAP接口更容易。

If you have 2 different applications communicating, sockets is the way to go. 如果您有2个不同的应用程序进行通信,那么套接字就是您的选择。 If your C++ layer is more like a library, you could also use JNI ( http://en.wikipedia.org/wiki/JNI , google for tutorials). 如果你的C ++层更像是一个库,你也可以使用JNI( http://en.wikipedia.org/wiki/JNI,google for tutorials)。

The choice of communication channel and blocking model is largely application dependent but sockets will probably work best if you don't need to worry about security. 通信通道和阻塞模型的选择在很大程度上取决于应用程序,但如果您不需要担心安全性,套接字可能会工作得最好。 SSL/Mutual auth is your next step up. SSL / Mutual auth是您的下一步。

I rolled my own, but I would use google protocol buffers if I had to do it all again. 我自己滚动,但如果我不得不再次使用谷歌协议缓冲区。 http://code.google.com/p/protobuf/ http://code.google.com/p/protobuf/

They seem to capture much of what people wanted out of ASN1 (but not all messed up) and let you do what people often try to do with serializing java Properties. 它们似乎捕获了人们想要的ASN1的大部分内容(但并非全部搞砸了)并让你做人们经常尝试的序列化java属性。

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

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