VoltRpc.Communication.Pipes
2.0.1
See the version list below for details.
dotnet add package VoltRpc.Communication.Pipes --version 2.0.1
NuGet\Install-Package VoltRpc.Communication.Pipes -Version 2.0.1
<PackageReference Include="VoltRpc.Communication.Pipes" Version="2.0.1" />
paket add VoltRpc.Communication.Pipes --version 2.0.1
#r "nuget: VoltRpc.Communication.Pipes, 2.0.1"
// Install VoltRpc.Communication.Pipes as a Cake Addin #addin nuget:?package=VoltRpc.Communication.Pipes&version=2.0.1 // Install VoltRpc.Communication.Pipes as a Cake Tool #tool nuget:?package=VoltRpc.Communication.Pipes&version=2.0.1
VoltRpc
VoltRpc - Library designed for high performance RPC communication.
Features
- Its fast (See the benchmarks)
- Supports all built-in C# value types, including:
Bool
Byte
Char
Decimal
Double
Float
Int
Long
SByte
Short
UInt
ULong
UShort
- Supports these built-in .NET types: (More to be added)
String
DateTime
TimeSpan
Uri
- Supports arrays for any type
- Easily support custom types by implementing a
TypeReadWriter<T>
- Proxy generated by using a .NET Source Generator
- Simple to use
Getting Started
Installation
VoltRpc can be installed from NuGet.
You can use the command below to install the package.
Install-Package VoltRpc
Proxy Generation
All proxy generation is handled by a .NET Source generator. You will need to install it's NuGet package.
You can use the command below to install the package.
Install-Package VoltRpc.Proxy.Generator
Example
For a more in-depth example, see the Overview or Setup.
There is also a demo project included.
Shared:
using VoltRpc.Proxy;
namespace VoltRpcExample.Shared
{
[GenerateProxy(GeneratedName = "TestProxy")]
public interface ITest
{
public void Basic();
public string Hello();
}
}
Host:
using System;
using System.Net;
using VoltRpc.Communication;
using VoltRpc.Communication.TCP;
using VoltRpcExample.Shared;
namespace VoltRpcExample
{
public class Program
{
public static void Main()
{
Host host = new TCPHost(new IPEndPoint(IPAddress.Loopback, 7767));
host.AddService<ITest>(new TestImpl());
host.StartListening();
Console.WriteLine("Press any key to stop...");
Console.ReadKey();
host.Dispose();
}
public class TestImpl : ITest
{
public void Basic()
{
Console.WriteLine("Hello!");
}
public string Hello()
{
return "Hello World!";
}
}
}
}
Client:
using System;
using System.Net;
using VoltRpc.Communication.TCP;
using VoltRpc.Proxy.Generated;
using VoltRpcExample.Shared;
namespace VoltRpcExample.Client
{
public class Program
{
public static void Main()
{
VoltRpc.Communication.Client client = new TCPClient(new IPEndPoint(IPAddress.Loopback, 7767));
client.AddService<ITest>();
client.Connect();
ITest testProxy = new TestProxy(client);
testProxy.Basic();
Console.WriteLine($"Got from server: {testProxy.Hello()}");
Console.WriteLine("Press any key to quit...");
Console.ReadKey();
client.Dispose();
}
}
}
Benchmarks
BenchmarkDotNet=v0.13.1, OS=ubuntu 21.10
Intel Core i5-10600KF CPU 4.10GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=6.0.100
[Host] : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Job-YXCTJF : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Jit=Default Platform=AnyCpu
Method | array | arraySize | message | Mean | Error | StdDev |
---|---|---|---|---|---|---|
BasicVoid | ? | ? | ? | 8.540 μs | 0.1634 μs | 0.2125 μs |
BasicReturn | ? | ? | ? | 9.488 μs | 0.1218 μs | 0.1080 μs |
ArrayReturn | ? | ? | ? | 9.528 μs | 0.1653 μs | 0.1546 μs |
ArrayParameterVoid | ? | 25 | ? | 9.233 μs | 0.0999 μs | 0.0885 μs |
ArrayParameterReturn | ? | 25 | ? | 9.427 μs | 0.1529 μs | 0.1636 μs |
ArrayParameterVoid | ? | 8294400 | ? | 9.290 μs | 0.1106 μs | 0.0924 μs |
ArrayParameterReturn | ? | 8294400 | ? | 9.631 μs | 0.1637 μs | 0.1531 μs |
BasicParameterVoid | ? | ? | Hello World! | 9.358 μs | 0.1194 μs | 0.1116 μs |
BasicParameterReturn | ? | ? | Hello World! | 9.891 μs | 0.1478 μs | 0.1383 μs |
For more info on these benchmarks see Benchmarks.
Authors
Voltstro - Initial work - Voltstro
License
This project is licensed under the MIT license – see the LICENSE.md file for details.
Credits
- Mirror
NetworkReader.cs
used as a base forBufferedReader.cs
NetworkWriter.cs
used as a base forBufferedWriter.cs
- Parts of
BufferedStream.cs
from the .NET Runtime was also used in the reader.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on VoltRpc.Communication.Pipes:
Repository | Stars |
---|---|
Voltstro-Studios/UnityWebBrowser
Unity Web Browser (UWB) is a Unity package that allows displaying and interacting with the web from within Unity.
|
See https://voltrpc.voltstro.dev/CHANGELOG.html for details