https://github.com/jacqueskang/ipcserviceframework
.NET Core Inter-process communication framework
https://github.com/jacqueskang/ipcserviceframework
dotnetcore interprocess-communication named-pipes tcp wcf
Last synced: 6 months ago
JSON representation
.NET Core Inter-process communication framework
- Host: GitHub
- URL: https://github.com/jacqueskang/ipcserviceframework
- Owner: jacqueskang
- License: mit
- Created: 2018-01-04T10:12:33.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2022-12-08T08:57:11.000Z (almost 3 years ago)
- Last Synced: 2025-04-08T09:08:48.515Z (6 months ago)
- Topics: dotnetcore, interprocess-communication, named-pipes, tcp, wcf
- Language: C#
- Size: 335 KB
- Stars: 364
- Watchers: 19
- Forks: 79
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
| CI build | Stable build |
|----------|--------------|
|[](https://dev.azure.com/jacques-kang/IpcServiceFramework/_build/latest?definitionId=9&branchName=develop)|[](https://dev.azure.com/jacques-kang/IpcServiceFramework/_build/latest?definitionId=14&branchName=master)|# 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 | [](https://badge.fury.io/nu/JKang.IpcServiceFramework.Client.NamedPipe) |
| JKang.IpcServiceFramework.Client.Tcp | Client SDK to consume IPC service over TCP | [](https://badge.fury.io/nu/JKang.IpcServiceFramework.Client.Tcp) |
| JKang.IpcServiceFramework.Hosting.NamedPipe | Server SDK to run Named pipe IPC service endpoint | [](https://badge.fury.io/nu/JKang.IpcServiceFramework.Hosting.NamedPipe) |
| JKang.IpcServiceFramework.Hosting.Tcp | Server SDK to run TCP IPC service endpoint | [](https://badge.fury.io/nu/JKang.IpcServiceFramework.Hosting.Tcp) |## Usage
1. Create an interface as service contract and package it in an assembly to be referenced by server and client applications, for example:
```csharp
public interface IInterProcessService
{
string ReverseString(string input);
}
```1. Implement the service in server application, for example:
```csharp
class InterProcessService : IInterProcessService
{
public string ReverseString(string input)
{
char[] charArray = input.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
}
```1. Install the following NuGet packages in server application:
```powershell
> Install-Package Microsoft.Extensions.Hosting
> Install-Package JKang.IpcServiceFramework.Hosting.NamedPipe
```1. Register the service implementation and configure IPC endpoint(s):
```csharp
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();
})
.ConfigureIpcHost(builder =>
{
// configure IPC endpoints
builder.AddNamedPipeEndpoint(pipeName: "pipeinternal");
})
.ConfigureLogging(builder =>
{
// optionally configure logging
builder.SetMinimumLevel(LogLevel.Information);
});
}
```1. Install the following NuGet package in client application:
```powershell
> Install-Package JKang.IpcServiceFramework.Client.NamedPipe
```1. Invoke the server
```csharp
// 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));
```## FAQs