I want call a method accepting a string as parameter on a console application from a completely different application. Purpose of the call is simply write a line to the console window from a different application for posting some debug lines. What could be the best way to achieve this? (I have control of both application sources)
-
If that is the case, why don't you implement that? http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx – rene Nov 15 '14 at 12:22
-
[Remoting](http://msdn.microsoft.com/library/kwdt6w2k%28v=VS.71%29.aspx) – IS4 Nov 15 '14 at 12:23
-
Post message through microsoft mq? – kidshaw Nov 15 '14 at 12:25
1 Answers
You could use anonymous pipes (on local machine) or named pipes (if you require the processes to communicate over network as well). Pipes are very common way for processes to communicate, other solutions include memory mapped file where the processes exchange messages or, and I very much discourage you to do this, a directory where messages are exchanged in form of files being created and their creation observed using FileSystemWatcher
.
You can see an example of names pipes in action on How to: Use Named Pipes for Network Interprocess Communication on MSDN. The example demonstrates two processes where one of them uses NamedPipeServerStream
and the consuming processes use NamedPipeClientStreams
to be able to intercept the incoming messages from the server application.
Here's an example of the same thing using anonymous pipes, if you don't require the processes to work over the network.

- 9,179
- 14
- 63
- 125
-
It seems like anonymous pipes will do the trick just the way I wanted. Thanks for the quick response. – CptShaze Nov 15 '14 at 12:31