VoltRpc 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package VoltRpc --version 3.0.0                
NuGet\Install-Package VoltRpc -Version 3.0.0                
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="VoltRpc" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VoltRpc --version 3.0.0                
#r "nuget: VoltRpc, 3.0.0"                
#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 VoltRpc as a Cake Addin
#addin nuget:?package=VoltRpc&version=3.0.0

// Install VoltRpc as a Cake Tool
#tool nuget:?package=VoltRpc&version=3.0.0                

VoltRpc

License NuGet NuGet Download Count Build Status Docs Status Discord

VoltRpc - An RPC library which is designed to be both simple to use and fast.

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
    • Guid
  • 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 will also need the proxy generator (also on NuGet).

<ItemGroup>
    <PackageReference Include="VoltRpc" Version="3.0.0" />
    <PackageReference Include="VoltRpc.Proxy.Generator" Version="2.1.0" />
</ItemGroup>

Example

For a more in-depth example, see the Overview or Setup.

There is also a demo project included.

[GenerateProxy(GeneratedName = "TestProxy")]
public interface ITestInterface
{
  public void DoSomethingCool();
  public int GetTheCoolValue();
}

public class TestInterface : ITestInterface
{
  public void DoSomethingCool()
  {
    Console.WriteLine("Something Cool!");
  }

  public int GetTheCoolValue()
  {
    return 69;
  }
}

public class Program
{
  IPEndPoint ip = new(IPAddress.Loopback, 7767);

  TestInterface test = new();

  //Host
  Host host = new TCPHost(ip);
  host.AddService<ITestInterface>(test);
  host.StartListening().ConfigureAwait(false);

  //Client
  Client client = new TCPClient(ip);
  client.AddService<ITestInterface>();
  client.Connect();

  //Now we can call to method like it was normal C#
  TestProxy proxy = new(client);
  proxy.DoSomethingCool();
}

Benchmarks

BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.1826 (21H2)
Intel Core i5-10600KF CPU 4.10GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=6.0.302
  [Host]     : .NET 6.0.7 (6.0.722.32202), X64 RyuJIT
  Job-TDLHXN : .NET 6.0.7 (6.0.722.32202), X64 RyuJIT

Jit=Default  Platform=AnyCpu  Runtime=.NET 6.0  

Pipes Non-Array

Pipes Non-Array

(Currently, the in-built arrays are quite a lot slower, we are looking into fixing this in a later release)

Method message array Mean Error StdDev
BasicVoid ? ? 6.311 μs 0.0517 μs 0.0432 μs
BasicReturn ? ? 7.444 μs 0.0589 μs 0.0551 μs
ArrayReturn ? ? 21.389 μs 0.3943 μs 0.6695 μs
ArrayFast ? ? 1,579.432 μs 10.1223 μs 9.4684 μs
BasicParameterVoid Hello World! ? 7.128 μs 0.0390 μs 0.0346 μs
BasicParameterReturn Hello World! ? 8.287 μs 0.0364 μs 0.0304 μs
ArrayParameterVoid ? Byte[25] 18.423 μs 0.3675 μs 0.6140 μs
ArrayParameterReturn ? Byte[25] 28.647 μs 0.5643 μs 0.9112 μs
ArrayParameterVoid ? Byte[8294400] 2,705,942.687 μs 11,965.3253 μs 11,192.3727 μs
ArrayParameterReturn ? Byte[8294400] 5,416,337.679 μs 21,036.1040 μs 18,647.9583 μ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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.
Version Downloads Last updated
3.2.1 252 10/20/2024
3.2.0 1,163 1/24/2024
3.1.0 2,423 9/20/2022
3.0.0 2,638 8/5/2022
2.1.0 2,400 5/22/2022
2.0.0 1,993 1/6/2022
1.3.0 1,678 12/30/2021
1.2.2 1,515 12/27/2021
1.2.1 1,495 12/27/2021
1.2.0 2,030 11/13/2021
1.1.1 1,830 8/7/2021
1.0.0 1,987 8/1/2021