Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Communication between different C# based services

Is there a way to communicate between two different services? I have a service that already runs. Is there a way to create a second service that can attach to the first service and send and receive dates to it?

I would also like to access the Windows service from a console application and attach to it. Is it possible?

like image 750
elisa Avatar asked Dec 27 '22 23:12

elisa


1 Answers

You can try to implement this by using:

  • IPC (Inter Process Communication via Named pipes)
  • Shared memory (Memory mapped files)
  • Socket (TCP/IP)

Example of using WCF: Many to One Local IPC using WCF and NetNamedPipeBindin.

Other example: A C# Framework for Interprocess Synchronization and Communication.

Everything depends on what version of .NET Framework you use. If you use .NET 3.0 and above then you can take a look into WCF. If not then you are on your own and you can google on keywords P/Invoke (CreateFileMapping, MapViewOfFile, CreatePipe...).

like image 135
HABJAN Avatar answered Jan 08 '23 06:01

HABJAN