'How to get an event from another program?
I've got Program A which uses an external Library Lib. Then there is a second program Program B. Program A calls a function in Lib which triggers an event. This event must processed from Program B. How can I do this?
If I would try to load Lib dynamically at runtime from Program B this would create a new instance and so I wouldn't get the event triggert from the Program A - Lib instance. So the question is for me how is the best practice to do this?
Solution 1:[1]
You cannot communicate between two processes that way. Security being one thing, process isolation and more.
There are multiple alternatives to achieve what you want
- Anonymous pipes
- Named pipes
- Sockets
Or if the communication is simple and trivial, a common persistence storage like a database or a file.
Documentation on anonymous pipes: https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-use-anonymous-pipes-for-local-interprocess-communication
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Athanasios Kataras |
