找到你要的答案

Q:RPC C++ server and Python client

Q:RPC的C++服务器和客户端

I would like to call functions in a C++ program from a Python program using RPC. I would also like to have the C++ program be able to periodically poll for the RPC calls, instead of calling a function that it does not return from.

I can do this using SUN RPC (ONC) between a C++ server and C++ client, but I'm not sure how to do this with a Python client.

The server and client will reside on the same machine.

Would anyone have a suggestion and perhaps a minimal example for how I might be able to achieve this?

EDIT: This is about calling functions in a running C++ server from a separate Python client using RPC, not calling functions in C++ library code from Python.

我想召集一个C++程序从使用RPC的Python程序的功能。我也想有C++程序能够定期轮询的RPC调用,而不是调用一个函数,它没有返回。

我可以使用Sun RPC做这个(ONC)一个C++ C++服务器和客户端之间,但是我不知道如何做一个客户端。

服务器和客户端将驻留在同一台机器上。

有人会有一个建议,也许是一个最小的例子,我怎么可能做到这一点?

编辑:这是关于调用在一个运行的C++服务器从使用RPC单独的客户端功能,不调用函数在C++代码库的Python。

answer1: 回答1:

I have seen Boost being used for interoperability between c++ and python.

boost.python

But there are many other options explained inn detail here:

interoperability

我已经看到增加使用C++和Python之间的互操作性。

boost.python

但这里有许多其他选项解释客栈细节:

互操作性

python  c++  rpc