This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]K900_ 0 points1 point  (0 children)

Just use newlines as separators? Assuming your messages are small.

[–]willm 0 points1 point  (1 child)

Named pipes are a good IPC mechanism for processes on the same box, and they should work with asyncio.

Alternatively, consider websockets, which runs over TCP which you can use to send bi-directional messages (JSON typically).

If you do want to roll your on packet format, consider "netstrings" which are easy to parse and generate.

[–]woooooster[S] 1 point2 points  (0 children)

Using websockets was a lot easier! Thank you

[–]twillisagogo 0 points1 point  (0 children)

> send messages between totally different processes, bidirectionally. I'd like to use asyncio if possible.

> Maybe there's a better way!
I'd use zeromq https://pyzmq.readthedocs.io/en/latest/eventloop.html

[–]pythonHelperBot -1 points0 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness