views:

195

answers:

6

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.

+2  A: 

Using sockets will work. Named pipes will also work.

Nick Whaley
+3  A: 

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.

Andomar
A: 

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

123Developer
+2  A: 

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.

ChrisW
+1 for the shared named event, that would be really simple as long as the apps run on the same machine. (You say mutex but I assume you mean event)
Andomar
A: 

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.

Garrett
A: 

CodeProject has a sample using .NET Remoting / IPC:

Single Instance Application, Passing Command Line Arguments

0xA3