Inter-process communication for python

我们两清 提交于 2021-02-19 06:24:06

问题


I'm having a problem creating a inter-process communication for my python application. I have two python scripts at hand, let's say A and B. A is used to open a huge file, keep it in memory and do some processing that Mysql can't do, and B is a process used to query A very often.

Since the file A needs to read is really large, I hope to read it once and have it hang there waiting for my Bs' to query.

What I do now is, I use cherrypy to build a http-server. However, I feel it's kind of awkward to do so since what I'm trying to do is absolutely local. So, I'm wondering are there other more organic way to achieve this goal?

I don't know much about TCP/socket etc. If possible, toy examples would be appreciate (please include the part to read file).


回答1:


Python has good support for ZeroMQ, which is much easier and more robust than using raw sockets.

The ZeroMQ site treats Python as one of its primary languages and offers copious Python examples in its documentation. Indeed, the example in "Learn the Basics" is written in Python.



来源:https://stackoverflow.com/questions/17118747/inter-process-communication-for-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!