PipeMethodCalls 4.0.1
PipeMethodCalls
Lightweight .NET Standard 2.0 library to use method calls over named and anonymous pipes for IPC. Supports two-way communication with callbacks.
Calls from client to server
var pipeServer = new PipeServer<IAdder>(
new NetJsonPipeSerializer(),
"mypipe",
() => new Adder());
await pipeServer.WaitForConnectionAsync();
var pipeClient = new PipeClient<IAdder>(new NetJsonPipeSerializer(), "mypipe");
await pipeClient.ConnectAsync();
int result = await pipeClient.InvokeAsync(adder => adder.AddNumbers(1, 3));
Calls both way
var pipeServer = new PipeServerWithCallback<IConcatenator, IAdder>(
new NetJsonPipeSerializer(),
"mypipe",
() => new Adder());
await pipeServer.WaitForConnectionAsync();
string concatResult = await pipeServer.InvokeAsync(c => c.Concatenate("a", "b"));
var pipeClient = new PipeClientWithCallback<IAdder, IConcatenator>(
new NetJsonPipeSerializer(),
"mypipe",
() => new Concatenator());
await pipeClient.ConnectAsync();
int result = await pipeClient.InvokeAsync(a => a.AddNumbers(4, 7));
About the library
This library uses named pipes to invoke method calls on a remote endpoint. The method arguments are serialized to binary and sent over the pipe.
Serialization
PipeMethodCalls supports customizable serialization logic through IPipeSerializer
. You've got two options:
- Use a pre-built serializer
new NetJsonPipeSerializer()
from the PipeMethodCalls.NetJson package. That uses the System.Text.Json serializer that's built into .NET.new MessagePackPipeSerializer()
from the PipeMethodCalls.MessagePack package. That uses the MessagePack-CSharp serializer, which has excellent performance.
- Plug in your own implementation of
IPipeSerializer
. Refer to the NetJsonPipeSerializer code for an example of how to do this.
Open an issue or pull request if you'd like to see more built-in serializers.
Features
- 100% asynchronous communication with .ConfigureAwait(false) to minimize context switches and reduce thread use
- 45KB with no built-in dependencies
- Invoking async methods
- Passing and returning complex types with pluggable JSON or binary serialization
- Interleaved or multiple simultaneous calls
- Throwing exceptions
- CancellationToken support
- Works on Windows, Linux and MacOS
Not supported
- Methods with out and ref parameters
- Properties
- Method overloads
Showing the top 20 packages that depend on PipeMethodCalls.
Packages | Downloads |
---|---|
LijsDev.CrystalReportsRunner.Core
API needed to use Crystal Reports Runner from caller applications.
|
1 |
LijsDev.CrystalReportsRunner.Core
API needed to use Crystal Reports Runner from caller applications.
|
2 |
LijsDev.CrystalReportsRunner.Core
API needed to use Crystal Reports Runner from caller applications.
|
3 |
LijsDev.CrystalReportsRunner.Core
API needed to use Crystal Reports Runner from caller applications.
|
6 |
Added README.md to the NuGet package.
.NET Standard 2.0
- No dependencies.
Version | Downloads | Last updated |
---|---|---|
4.0.2 | 0 | 05/19/2024 |
4.0.1 | 1 | 03/12/2024 |
4.0.0 | 1 | 03/05/2024 |
3.2.1 | 1 | 03/12/2024 |
3.2.0 | 6 | 09/01/2023 |
3.1.1 | 1 | 03/13/2024 |
3.1.0 | 2 | 03/02/2024 |
3.0.4 | 3 | 03/02/2024 |
3.0.3 | 1 | 03/17/2024 |
3.0.2 | 3 | 03/03/2024 |
3.0.1 | 1 | 03/04/2024 |
3.0.0 | 2 | 03/04/2024 |
2.1.0 | 1 | 03/16/2024 |
2.0.2 | 1 | 03/18/2024 |
2.0.1 | 1 | 03/04/2024 |
2.0.0 | 1 | 03/02/2024 |
1.0.1 | 1 | 03/06/2024 |
1.0.0 | 1 | 03/18/2024 |