for sure.
you can use Named Pipe classes in C #:
Server:
using (var s = new NamedPipeServerStream ("myPipe")) { s.WaitForConnection(); s.WriteByte (100); Console.WriteLine (s.ReadByte()); }
client code:
using (var s = new NamedPipeClientStream ("myPipe")) { s.Connect(); Console.WriteLine (s.ReadByte()); s.WriteByte (200); }
change
you can do it by file. + systemfileWatcher Class
put the file in a folder.
another process will check this folder.
and now you can transfer information.
edit2
you can use memoryMappedFile
and open a view in each process to see the same mempry region, and transfer data. I consider it the best.
Process A:
static void Main(string[] args) { using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew("testmap", 4000)) { bool mutexCreated; Mutex mutex = new Mutex(true, "testmapmutex", out mutexCreated); using (MemoryMappedViewStream stream = mmf.CreateViewStream()) { BinaryWriter writer = new BinaryWriter(stream); string st = "Hellow"; int stringSize = Encoding.UTF8.GetByteCount(st);
Process B writes to its area
static void Main(string[] args) { try { using (MemoryMappedFile mmf = MemoryMappedFile.OpenExisting("testmap")) { Mutex mutex = Mutex.OpenExisting("testmapmutex"); mutex.WaitOne(); using (MemoryMappedViewStream stream = mmf.CreateViewStream(11, 0))
source share