Edwin Yip 154 Posted March 8, 2023 20 hours ago, ertank said: What you are looking for is "Inter Process Communication" aka IPC. For more details you can look here I used Cromis for named pipes. There is built in encryption support in that library, if you may need such functionality. The Cromis IPC framework is very well designed, it has a background thread running for receiving the messages, and only call your event handler when there is a message. I have several successful use cases with it. Share this post Link to post
pyscripter 689 Posted March 8, 2023 (edited) The IPC unit based on named pipes created by Russell Libby in 2003 and updated by @FPiette is worth checking. Blog article: Behind the connection: Inter Process Communication Using Pipes (francois-piette.blogspot.com) Source code: OverByte - Blog Source Code Named pipes in overlapped mode are super efficient and faster than sockets. See Synchronous and Overlapped Pipe I/O - Win32 apps | Microsoft Learn. See also I/O Completion Ports - Win32 apps | Microsoft Learn. I have contributed such a solution to the python library RPyC and it beats the socket based IPC by a large margin. The downside is that it is Windows only. Edited March 8, 2023 by pyscripter Share this post Link to post
softtouch 9 Posted March 8, 2023 5 hours ago, Edwin Yip said: The Cromis IPC framework is very well designed, it has a background thread running for receiving the messages, and only call your event handler when there is a message. I have several successful use cases with it. Correct, I use it since years also in many programs and never had any issue. Share this post Link to post
Lars Fosdal 1792 Posted March 8, 2023 Regular TCP telegrams are low cost, event oriented, cross platform, cross tool. The only hassle is identifying the port of the server, which typically would be a config setting. Share this post Link to post
Fr0sT.Brutal 900 Posted March 16, 2023 My thoughts... 1 - don't need 3 apps, just unite service and console into one 2 - type of IPC depends on your needs: - STDIN/OUT are the simplest and x-platform but only if an app works in request-process-reply sheme. Pipes as they are will make apps stuck (writer if the pipe is full, reader if the pipe is empty). - Async STDIN/OUT pipes are more complex and probably not portable (or require porting to all platforms). They have nice "pro" of zero-conf (if a worker app is launched by another one, the launcher already knows the handles) or, in the case of named pipes, could be identified with a constant name. - Sockets are the most powerful and could be async but they have to occupy a port to listen which both sides must be aware of. In the case of one app launching another the port could be left to OS to decide any and launched app could report the actual number to STDOUT. Share this post Link to post