I have a .net based windows application which is running in memory. I want to trigger one of the function in the app from an external application which is not .net based. How can I achieve this? The triggering should be real time.
Make the first app listen on a TCP port. Make the second application connect to the TCP port and send "WAKE UP LAZY PROGRAM". Make the first app respond to that by doing something.
Hey,
Can't you send and XML message string to .net application which is listening in a specific port from the non .net application. By analyzing this XML message you may invoke the specific function in the .net application..
A wild guess.
thanks 123Developer
If the program weren't .net I'd suggest sending or positing a window message: see PostMessage
and RegisterWindowMessage
. To receive such a message in the .net program I think you may need to PInvoke RegisterWndowMessage
, and override your WndProc
.
Another good possibility is to share a named mutex.
You should define what you mean by "real time": on the one hand nothing is real-time on Windows, and on the other hand when you start to back off from that and to say instead "nearly real time" or "soft real time" then many solutions become possible.
Message-passing is probably the way to go. Utilizing sockets would work as well, but
a) could open up security vulnerabilities, and
b) could be a problem with firewall software on some machines.