IceRpc 0.2.0
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package IceRpc --version 0.2.0
NuGet\Install-Package IceRpc -Version 0.2.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="IceRpc" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceRpc --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IceRpc, 0.2.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 IceRpc as a Cake Addin #addin nuget:?package=IceRpc&version=0.2.0 // Install IceRpc as a Cake Tool #tool nuget:?package=IceRpc&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- ZeroC.Slice (= 0.2.0)
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.
|