VoltRpc 2.1.0
See the version list below for details.
dotnet add package VoltRpc --version 2.1.0
NuGet\Install-Package VoltRpc -Version 2.1.0
<PackageReference Include="VoltRpc" Version="2.1.0" />
paket add VoltRpc --version 2.1.0
#r "nuget: VoltRpc, 2.1.0"
// Install VoltRpc as a Cake Addin #addin nuget:?package=VoltRpc&version=2.1.0 // Install VoltRpc as a Cake Tool #tool nuget:?package=VoltRpc&version=2.1.0
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. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on VoltRpc:
Package | Downloads |
---|---|
VoltRpc.Communication.Pipes
VoltRpc.Communication.Pipes - Provides named pipes (System.IO.Pipes) communication to VoltRpc. |
|
VoltRpc.Extension.Vectors
VoltRpc.Extension.Vectors - Extends VoltRpc's reader and writer by supporting most System.Numerics.Vectors types. Also adds the higher-level type readers and writers. |
|
VoltRpc.Extension.Memory
VoltRpc.Extension.Memory - Extends VoltRpc's reader and writer with Span and Memory support. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on VoltRpc:
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