Install VoltRpc
Add to your project's csproj
.
<ItemGroup>
<PackageReference Include="VoltRpc" Version="3.0.0" />
<PackageReference Include="VoltRpc.Proxy.Generator" Version="2.1.0" />
</ItemGroup>
And Start Using!
[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();
}
For a more in-depth guide, see the setup section.
Its fast!
Checkout the benchmarks for more details.
Supports all built-in C# value types
Supports all the built-in value types, including: Bool
, Byte
, Char
, Decimal
, etc.
Simple to use
The use of the VoltRpc's proxy .NET source generator and type readers/writers allows for ease of use.