NamedPipes.Helper
1.0.1.1
dotnet add package NamedPipes.Helper --version 1.0.1.1
NuGet\Install-Package NamedPipes.Helper -Version 1.0.1.1
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="NamedPipes.Helper" Version="1.0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NamedPipes.Helper --version 1.0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NamedPipes.Helper, 1.0.1.1"
#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.
// Install NamedPipes.Helper as a Cake Addin #addin nuget:?package=NamedPipes.Helper&version=1.0.1.1 // Install NamedPipes.Helper as a Cake Tool #tool nuget:?package=NamedPipes.Helper&version=1.0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Named Pipes Helper
Simple library to work with named pipes for IPC communication.
Also includes a helper to assist with creating single instance applications and forwarding messages between them.
See example code Here
Getting started
Install package Nuget package
Install-Package NamedPipes.Helper
Server
Listen for messages on pipe named 'MyPipeName' with 2 threads
_server = new Server("MyPipeName", (mesage) =>
{
Console.WriteLine(message);
});
_server.Start(2);
Client
Publish message to pipe named 'MyPipeName'
Async
await Client.SendMessageAsync("MyPipeName","a test message");
Synchronise
Client.SendMessage("MyPipeName","a test message");
Single Instance Application
Only allow single instance of app
internal static class Program
{
static Form1? _form;
[STAThread]
static void Main(string[] args)
{
ApplicationConfiguration.Initialize();
App.SingleInstance("MyAppId", () =>
{
_form = new Form1();
Application.Run(_form);
});
}
}
Only allow single instance of app and send message to already running instance
internal static class Program
{
static Form1? _form;
[STAThread]
static void Main(string[] args)
{
ApplicationConfiguration.Initialize();
App.SingleInstance("MyAppId", () =>
{
_form = new Form1();
Application.Run(_form);
},(mesage)=> {
_form?.Invoke(()=> _form.ShowMessage(mesage));
}, args.Length> 0 ?
$"Another instance started with args : {string.Join(" ", args)}"
: "Another instance started with no args");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- System.ServiceModel.Primitives (>= 4.10.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.