.NET Core Inter-process communication framework
.NET Core Inter-process communication framework
| CI build | Stable build |
|---|---|
A .NET Core 3.1 based lightweight framework for efficient inter-process communication. Named pipeline and TCP support out-of-the-box, extensible with other protocols.
| Name | Purpose | Status |
|---|---|---|
| JKang.IpcServiceFramework.Client.NamedPipe | Client SDK to consume IPC service over Named pipe | |
| JKang.IpcServiceFramework.Client.Tcp | Client SDK to consume IPC service over TCP | |
| JKang.IpcServiceFramework.Hosting.NamedPipe | Server SDK to run Named pipe IPC service endpoint | |
| JKang.IpcServiceFramework.Hosting.Tcp | Server SDK to run TCP IPC service endpoint |
Create an interface as service contract and package it in an assembly to be referenced by server and client applications, for example:
public interface IInterProcessService
{
string ReverseString(string input);
}Implement the service in server application, for example:
class InterProcessService : IInterProcessService
{
public string ReverseString(string input)
{
char[] charArray = input.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
}Install the following NuGet packages in server application:
> Install-Package Microsoft.Extensions.Hosting
> Install-Package JKang.IpcServiceFramework.Hosting.NamedPipeRegister the service implementation and configure IPC endpoint(s):
…Install the following NuGet package in client application:
> Install-Package JKang.IpcServiceFramework.Client.NamedPipeInvoke the server
// register IPC clients
ServiceProvider serviceProvider = new ServiceCollection()
.AddNamedPipeIpcClient("client1", pipeName: "pipeinternal")
.BuildServiceProvider();
// resolve IPC client factory
IIpcClientFactory clientFactory = serviceProvider
.GetRequiredService>();
// create client
IIpcClient client = clientFactory.CreateClient("client1");
string output = await client.InvokeAsync(x => x.ReverseString(input));No open issues yet, or sync has not completed.