socpipe:进程间通信的非常简单的方法

时间:2021-03-21 00:35:41
【文件属性】:
文件名称:socpipe:进程间通信的非常简单的方法
文件大小:3KB
文件格式:ZIP
更新时间:2021-03-21 00:35:41
Python 概述 soctype提供了非常简单的进程间通信方式。这仅在内部使用socket , json和threading ,它们是标准模块。 安装 pip install socpipe或pip3 install socpipe 用法 首先,请声明一些类似以下的功能: # in process1 def add(a,b): return a+b 然后,请创建ApiServer实例,并使您的API对其他进程可见。 # in process1 from socpipe import * api=ApiServer(apis=[add]) api.publish(port=50007) while True: pass 其中port是socket内部将使用的端口号,您可以设置任何您喜欢的数字。执行api.publish之后,将生成新线程并等待连接。因此,您需要防止process1 while
【文件预览】:
socpipe-main
----socpipe.py(3KB)
----LICENSE(1KB)
----__init__.py(37B)
----README.md(1KB)

网友评论