7

Possible Duplicate:
IPC Mechanisms in C# - Usage and Best Practices

I have two diffenent process: A and B.

The process A wants to send to the process B some data (array of bytes, strings, structures, etc...). So suppose A need to send the following buffer:

var buffer = new byte[100].
SendToAnotherProcess(B, buffer);

And B need to receive this buffer:

byte[] buffer;
ReceiveFromAnotherProcess(A, out buffer);

What is the easiest solution to do this?

Community
  • 1
  • 1
Nick
  • 10,309
  • 21
  • 97
  • 201

4 Answers4

7

You can use Named Pipe. If it is C# 4.0 and above, you can also use Memory mapped file

Tilak
  • 30,108
  • 19
  • 83
  • 131
2

There's a multitude of options. To name a few low-level IPC mechanisms:

  • named pipes
  • shared memory
  • TCP/IP sockets

Also, there are some higher-level options:

  • .NET Remoting
  • WCF
Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
0

One common way is to use files to communicate between the processed.

Each can write to a specific file that the other reads from.

You can use WCF, the registry, network interface, message queues or any other mechanism that lives outside the process.

Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

There is some special instrument in .net:

.Net Remoting

WCF

Kirill Bestemyanov
  • 11,946
  • 2
  • 24
  • 38