文件名称:实现远程方法调用-python cookbook(第3版)高清中文完整版
文件大小:4.84MB
文件格式:PDF
更新时间:2024-06-29 23:06:37
python cookbook 第3版 高清 中文完整版
11.8 实现远程方法调用 问题 You want to implement simple remote procedure call (RPC) on top of a message passing layer, such as sockets, multiprocessing connections, or ZeroMQ. 解决方案 RPC is easy to implement by encoding function requests, arguments, and return values using pickle, and passing the pickled byte strings between interpreters. Here is an example of a simple RPC handler that could be incorporated into a server: # rpcserver.py import pickle class RPCHandler: