ricaun.NamedPipeWrapper.Json
1.8.0
Prefix Reserved
dotnet add package ricaun.NamedPipeWrapper.Json --version 1.8.0
NuGet\Install-Package ricaun.NamedPipeWrapper.Json -Version 1.8.0
<PackageReference Include="ricaun.NamedPipeWrapper.Json" Version="1.8.0" />
paket add ricaun.NamedPipeWrapper.Json --version 1.8.0
#r "nuget: ricaun.NamedPipeWrapper.Json, 1.8.0"
// Install ricaun.NamedPipeWrapper.Json as a Cake Addin #addin nuget:?package=ricaun.NamedPipeWrapper.Json&version=1.8.0 // Install ricaun.NamedPipeWrapper.Json as a Cake Tool #tool nuget:?package=ricaun.NamedPipeWrapper.Json&version=1.8.0
ricaun.NamedPipeWrapper.Json
Named Pipe Wrapper Json for .NET Framework 4.0 and .NET Core 6.0.
This project is based of Andrew C. Dvorak's work at Named Pipe Wrapper, updated to support NET Core and Json.
PackageReference
<PackageReference Include="ricaun.NamedPipeWrapper.Json" Version="*" />
Features
- Create named pipe servers that can handle multiple client connections simultaneously.
- Send strongly-typed messages between clients and servers: any serializable .NET object can be sent over a pipe and will be automatically serialized/deserialized, including cyclical references and complex object graphs.
- Messages are sent and received asynchronously on a separate background thread and marshalled back to the calling thread (typically the UI).
- Supports large messages - up to 300 MiB.
- Design to work inside Autodesk Revit without conflict.
Json
By default, all classes gonna be serialized/deserialized by JsonExtension.JsonService
with the interface IJsonService
, in the end, a JSON string is passed using the PipeStream
.
If Newtonsoft.Json
exists in the project, the NewtonsoftJsonService
will be used instead of the default JsonService
.
The default JsonService
for NETFRAMWORK use System.Web.Extensions
, and for NETCOREAPP the System.Text.Json
.
Usage
Server:
var server = new NamedPipeServer<SomeClass>("MyServerPipe");
server.ClientConnected += delegate(NamedPipeConnection<SomeClass> conn)
{
Console.WriteLine("Client {0} is now connected!", conn.Id);
conn.PushMessage(new SomeClass { Text: "Welcome!" });
};
server.ClientMessage += delegate(NamedPipeConnection<SomeClass> conn, SomeClass message)
{
Console.WriteLine("Client {0} says: {1}", conn.Id, message.Text);
};
// Start up the server asynchronously and begin listening for connections.
// This method will return immediately while the server runs in a separate background thread.
server.Start();
// ...
Client:
var client = new NamedPipeClient<SomeClass>("MyServerPipe");
client.ServerMessage += delegate(NamedPipeConnection<SomeClass> conn, SomeClass message)
{
Console.WriteLine("Server says: {0}", message.Text);
};
// Start up the client asynchronously and connect to the specified server pipe.
// This method will return immediately while the client runs in a separate background thread.
client.Start();
// ...
NamedPipeUtils
The NamedPipeUtils
class provides some utility methods for working with named pipes.
bool pipeExists = NamedPipeUtils.PipeFileExists("MyServerPipe");
IJsonService
Override the default JsonService
with the interface IJsonService
:
JsonExtension.JsonService = new MyJsonService();
Release
License
This project is licensed under the MIT License.
Do you like this project? Please star this project on GitHub!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net8.0-windows7.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.8.0 | 136 | 9/26/2024 |