mburm
mburm

Reputation: 1493

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?

Upvotes: 0

Views: 35

Answers (1)

Athanasios Kataras
Athanasios Kataras

Reputation: 26352

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

  1. Anonymous pipes
  2. Named pipes
  3. Sockets

Or if the communication is simple and trivial, a common persistence storage like a database or a file.

Documentation on anonymous pipes: https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-use-anonymous-pipes-for-local-interprocess-communication

Upvotes: 2

Related Questions