简体   繁体   中英

Exchanging data between two console applications

I have 2 console C# applications, for the sake of this example lets call them app a and app b .

app a executes app b and passes parameters to it, in turn app b processes this information and writes back its responses to console.

I want to know how app a can get 'back' these responses, which were written by app b into the console?

您可以使用某种进程间通信(IPC):共享内存,管道,套接字等。一种更简单的方法是使用文件,但是在这种情况下,您必须确保一次只有一个程序访问文件(使用例如命名的互斥体)。

There's a few ways to do this: you could write to a file, for example.

Personally I like anonymous pipes: detail and an example are here:

http://msdn.microsoft.com/en-us/library/bb546102.aspx

您可以在命名管道上使用WCF

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM