简体   繁体   English

RPC C ++服务器和Python客户端

[英]RPC C++ server and Python client

I would like to call functions in a C++ program from a Python program using RPC. 我想使用RPC从Python程序中调用C ++程序中的函数。 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. 我还希望C ++程序能够定期轮询RPC调用,而不是调用它不会从中返回的函数。

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. 我可以在C ++服务器和C ++客户端之间使用SUN RPC(ONC)来执行此操作,但是我不确定如何使用Python客户端执行此操作。

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. 编辑:这是关于使用RPC从单独的Python客户端调用正在运行的C ++服务器中的函数,而不是从Python调用C ++库代码中的函数。

I have seen Boost being used for interoperability between c++ and python. 我已经看到Boost用于实现c ++和python之间的互操作性。

boost.python boost.python

But there are many other options explained inn detail here: 但是这里还有许多其他选项详细解释了客栈:

interoperability 互通性

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

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