Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt and Boost RPC

Tags:

rpc

boost

qt

I'm looking for a good way to connect two systems: 1) a Qt based application running on Ubuntu and 2) a Boost based application running on another Ubuntu machine. Both applications use a common library where I would put the common interface code. I'd like to use a RPC type interface. I've looked at CORBA and D-Bus but I'm wondering what other people have used or would recommend.

Thanks in advance.

like image 629
Brad Avatar asked Nov 23 '11 01:11

Brad


2 Answers

Apache Thrift is a cross-language RPC framework originally developed by Facebook. A prototype I wrote a while ago used it, I think it was quite simple to use (I don't remember any problems). It would be a good choice if you may later want to extend the system with components written in other languages.

like image 144
Silas Parker Avatar answered Nov 11 '22 07:11

Silas Parker


You might consider ØMQ. It is a cross-platform messaging library that, among many other things, "automagically" handles connection issues (including reconnecting in the case of failures). There are bindings in many languages, and the czmq library provides a nice high-level C interface for many common uses of ØMQ.

You could easily use the Request-Reply pattern for an RPC framework, but as you read the guide, you may find that other patterns are more appropriate.

I did find an RPC framework built on top of ØMQ, but since you are apparently using C++, this probably won't help you (other than for learning purposes). See also this question. You could probably quite easily roll your own, if you want.

The license of ØMQ is "LGPLv3+", which is basically LGPL with a static linking exception. czmq is moving to the MPLv2, so I would not be surprised if ØMQ follows suit soon. According to a message from the ØMQ creator, the MPLv2 is very similar to the "LGPLv3+" license, but more acceptable to enterprise lawyers.

You might also consider boost serialization for your interface code. We used czmq (including zbeacon for automatic node discovery) together with boost serialization, and it works very well. I have used XML-RPC in the past, and I much prefer ØMQ for the connection handling functionality it offers.

like image 45
Patrick Avatar answered Nov 11 '22 07:11

Patrick