IceRpc 0.4.1

Prefix Reserved
dotnet add package IceRpc --version 0.4.1                
NuGet\Install-Package IceRpc -Version 0.4.1                
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="IceRpc" Version="0.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceRpc --version 0.4.1                
#r "nuget: IceRpc, 0.4.1"                
#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 IceRpc as a Cake Addin
#addin nuget:?package=IceRpc&version=0.4.1

// Install IceRpc as a Cake Tool
#tool nuget:?package=IceRpc&version=0.4.1                

IceRPC

IceRPC is a modular RPC framework that helps you build networked applications with minimal effort. The IceRpc assembly and package represent the base assembly and package for the C# implementation of IceRPC.

Package | Source code | Getting started | Examples | Documentation | API reference

Sample Code

// Client application

using GreeterCore; // for the StringCodec helper class
using IceRpc;

await using var connection = new ClientConnection(new Uri("icerpc://localhost"));

string greeting = await GreetAsync(Environment.UserName);
Console.WriteLine(greeting);

await connection.ShutdownAsync();

// Create the request to the greeter and then await and decode the response.
async Task<string> GreetAsync(string name)
{
    // Construct an outgoing request for the icerpc protocol.
    using var request = new OutgoingRequest(new ServiceAddress(Protocol.IceRpc))
    {
        Operation = "greet",
        Payload = StringCodec.EncodeString(name)
    };

    // Make the invocation: we send the request using the client connection and then wait
    // for the response. Since the client connection is not connected yet, this call also
    // connects it.
    IncomingResponse response = await connection.InvokeAsync(request);

    // When the response's status code is Ok, we decode its payload.
    if (response.StatusCode == StatusCode.Ok)
    {
        return await StringCodec.DecodePayloadStringAsync(response.Payload);
    }
    else
    {
        // Convert the response into a dispatch exception.
        throw new DispatchException(response.StatusCode, response.ErrorMessage);
    }
}
// Server application

using GreeterCore; // for the StringCodec helper class
using IceRpc;

// Create a server that will dispatch all requests to the same dispatcher, an instance of
// Chatbot.
await using var server = new Server(new Chatbot());
server.Listen();

// Wait until the console receives a Ctrl+C.
await CancelKeyPressed;
await server.ShutdownAsync();

internal class Chatbot : IDispatcher
{
    public async ValueTask<OutgoingResponse> DispatchAsync(
        IncomingRequest request,
        CancellationToken cancellationToken)
    {
        if (request.Operation == "greet")
        {
            string name = await StringCodec.DecodePayloadStringAsync(request.Payload);
            Console.WriteLine($"Dispatching greet request {{ name = '{name}' }}");

            return new OutgoingResponse(request)
            {
                Payload = StringCodec.EncodeString($"Hello, {name}!")
            };
        }
        else
        {
            // We only implement greet.
            return new OutgoingResponse(request, StatusCode.NotImplemented);
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (13)

Showing the top 5 NuGet packages that depend on IceRpc:

Package Downloads
IceRpc.Slice

IceRpc.Slice for C#.

IceRpc.Deadline

Deadline interceptor and middleware for IceRPC

IceRpc.Logger

Logger interceptor and middleware for IceRPC

IceRpc.Extensions.DependencyInjection

Dependency injection extensions for IceRPC

IceRpc.Transports.Quic

QUIC transport for IceRPC

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on IceRpc:

Repository Stars
icerpc/icerpc-csharp
A C# RPC framework built for QUIC, with bidirectional streaming, first-class async/await, and Protobuf support.
Version Downloads Last updated
0.4.1 174 11/15/2024
0.4.0.1 293 9/17/2024
0.4.0 243 9/16/2024
0.3.1 1,624 3/28/2024
0.3.0 772 2/14/2024
0.2.1 723 12/12/2023
0.2.0 466 12/4/2023
0.1.2 503 10/9/2023
0.1.1 330 9/18/2023
0.1.0 381 9/6/2023