IpcServiceFramework
.NET Core Inter-process communication framework
Install / Use
/learn @jacqueskang/IpcServiceFrameworkREADME
| CI build | Stable build |
|----------|--------------|
||
|
IpcServiceFramework
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.
NuGet packages
| 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 |
|
Usage
-
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.NamedPipe -
Register the service implementation and configure IPC endpoint(s):
class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureServices(services => { services.AddScoped<IInterProcessService, InterProcessService>(); }) .ConfigureIpcHost(builder => { // configure IPC endpoints builder.AddNamedPipeEndpoint<IInterProcessService>(pipeName: "pipeinternal"); }) .ConfigureLogging(builder => { // optionally configure logging builder.SetMinimumLevel(LogLevel.Information); }); } -
Install the following NuGet package in client application:
> Install-Package JKang.IpcServiceFramework.Client.NamedPipe -
Invoke the server
// register IPC clients ServiceProvider serviceProvider = new ServiceCollection() .AddNamedPipeIpcClient<IInterProcessService>("client1", pipeName: "pipeinternal") .BuildServiceProvider(); // resolve IPC client factory IIpcClientFactory<IInterProcessService> clientFactory = serviceProvider .GetRequiredService<IIpcClientFactory<IInterProcessService>>(); // create client IIpcClient<IInterProcessService> client = clientFactory.CreateClient("client1"); string output = await client.InvokeAsync(x => x.ReverseString(input));
FAQs
Related Skills
node-connect
339.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
