jessek1 / grpc-dotnet-namedpipes

Windows named pipe transport for gRPC in C#/.NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GrpcDotNetNamedPipes

NuGet

Windows named pipe transport for gRPC in C#/.NET.

This is not an official Google product.

Supported platforms

  • .NET Framework 4.6+ (Windows)
  • .NET Core 2.1+ (Windows)

Usage

Suppose you have a Greeter service as described in the gRPC on .NET Core intro.

Server:

var server = new NamedPipeServer("MY_PIPE_NAME");
Greeter.BindService(server.ServiceBinder, new GreeterService());
server.Start();

Client:

var channel = new NamedPipeChannel(".", "MY_PIPE_NAME");
var client = new Greeter.GreeterClient(channel);

var response = await client.SayHello(
	new HelloRequest { Name = "World" });

Console.WriteLine(response.Message);

Why named pipes?

Named pipes are suitable for inter-process communication (IPC).

Compared with gRPC over HTTP (using grpc or grpc-dotnet), you get:

  • Better access controls (e.g. current user only)
  • Lightweight pure .NET library (instead of 3MB+ native DLL or ASP.NET Core dependency)
  • Much faster startup time
  • 2x-3x faster large message throughput
  • No firewall warnings
  • No network adapter required

Caveats

This implementation currently uses a custom wire protocol so it won't be compatible with other gRPC named pipe implementations.

About

Windows named pipe transport for gRPC in C#/.NET

License:Apache License 2.0


Languages

Language:C# 100.0%