Soukoku.SimpleIpc
1.0.0.3
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package Soukoku.SimpleIpc --version 1.0.0.3
NuGet\Install-Package Soukoku.SimpleIpc -Version 1.0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soukoku.SimpleIpc" Version="1.0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soukoku.SimpleIpc" Version="1.0.0.3" />
<PackageReference Include="Soukoku.SimpleIpc" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soukoku.SimpleIpc --version 1.0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soukoku.SimpleIpc, 1.0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soukoku.SimpleIpc@1.0.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soukoku.SimpleIpc&version=1.0.0.3
#tool nuget:?package=Soukoku.SimpleIpc&version=1.0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SimpleIpc
A lightweight IPC library for bidirectional communication between parent and child processes using named pipes. Supports .NET Framework 4.6.2+ and .NET 8.0+.
Features
- Request-response pattern with automatic correlation
- Fire-and-forget messages
- Typed handler registration
- Bidirectional communication
- Concurrent request support
- Timeout handling
- Custom serializer support
Installation
dotnet add package Soukoku.SimpleIpc
Usage
Parent Process
using SimpleIpc;
await using var connection = await IpcParentConnection.StartChildAsync("child.exe");
// Register handlers for messages from child
connection.On<InfoRequest, InfoResponse>(req =>
new InfoResponse($"Parent PID: {Environment.ProcessId}"));
connection.On<StatusNotification>(msg =>
Console.WriteLine($"Child says: {msg.Message}"));
// Send request to child
var result = await connection.RequestAsync<CalculateRequest, CalculateResponse>(
new CalculateRequest(10, 5, "+"));
Console.WriteLine($"Result: {result.Value}");
// Fire-and-forget
await connection.SendAsync(new StatusNotification("Hello"));
Child Process
using SimpleIpc;
await using var connection = await IpcChildConnection.ConnectAsync(args);
// Register request handler
connection.On<CalculateRequest, CalculateResponse>(req =>
{
int result = req.Operation switch
{
"+" => req.A + req.B,
"-" => req.A - req.B,
_ => throw new NotSupportedException()
};
return new CalculateResponse(result);
});
// Handle one-way messages
connection.On<StatusNotification>(msg =>
Console.WriteLine($"Parent says: {msg.Message}"));
// Child can also request from parent
var info = await connection.RequestAsync<InfoRequest, InfoResponse>(
new InfoRequest("version"));
// Wait until disconnected
await Task.Delay(-1, connection.DisconnectedToken);
Handler Registration
Synchronous handlers
connection.On<TRequest, TResponse>(request => new TResponse(...));
connection.On<TMessage>(message => Console.WriteLine(message));
Async handlers
connection.On<TRequest, TResponse>(async (request, ct) => {
await Task.Delay(100, ct);
return new TResponse(...);
});
connection.On<TMessage>(async (message, ct) => {
await ProcessAsync(message, ct);
});
Request Timeout
var result = await connection.RequestAsync<TReq, TRes>(
request,
timeout: TimeSpan.FromSeconds(5));
Error Handling
Exceptions thrown in handlers are propagated to the caller as IpcRemoteException:
try
{
await connection.RequestAsync<TReq, TRes>(request);
}
catch (IpcRemoteException ex)
{
Console.WriteLine($"Remote error: {ex.Message}");
}
catch (TimeoutException ex)
{
Console.WriteLine("Request timed out");
}
catch (IpcDisconnectedException ex)
{
Console.WriteLine("Connection lost");
}
Disconnection Handling
connection.Disconnected += (sender, e) => Console.WriteLine("Disconnected");
// Use token for async operations
await Task.Delay(-1, connection.DisconnectedToken);
// Check status
if (connection.IsConnected) { ... }
Custom Serialization
Implement IIpcSerializer for custom serialization:
public class MessagePackSerializer : IIpcSerializer
{
public string Serialize<T>(T value) { ... }
public string Serialize(object value) { ... }
public T? Deserialize<T>(string? data) { ... }
public object? Deserialize(string? data, Type type) { ... }
}
// Use custom serializer
await IpcParentConnection.StartChildAsync("child.exe", new MessagePackSerializer());
await IpcChildConnection.ConnectAsync(args, new MessagePackSerializer());
API Reference
IpcParentConnection
| Member | Description |
|---|---|
StartChildAsync(path, timeout?, ct) |
Start child and connect |
On<TReq, TRes>(handler) |
Register request handler |
On<TMsg>(handler) |
Register message handler |
RequestAsync<TReq, TRes>(req, timeout?, ct) |
Send request and await response |
SendAsync<T>(msg, ct) |
Send fire-and-forget message |
WaitForExitAsync(ct) |
Wait for child to exit |
ChildProcessId |
Child process ID |
IsConnected |
Connection status |
DisconnectedToken |
Cancellation token for disconnection |
Disconnected |
Disconnection event |
IpcChildConnection
| Member | Description |
|---|---|
ConnectAsync(args, timeout?, ct) |
Connect to parent |
On<TReq, TRes>(handler) |
Register request handler |
On<TMsg>(handler) |
Register message handler |
RequestAsync<TReq, TRes>(req, timeout?, ct) |
Send request and await response |
SendAsync<T>(msg, ct) |
Send fire-and-forget message |
ParentProcessId |
Parent process ID (if available) |
IsConnected |
Connection status |
DisconnectedToken |
Cancellation token for disconnection |
Disconnected |
Disconnection event |
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- System.Text.Json (>= 8.0.5)
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0.3 | 76 | 1/14/2026 |