Windows named pipe transport for gRPC in C#/.NET.
This is not an official Google product.
- .NET Framework 4.6+ (Windows)
- .NET Core 2.1+ (Windows)
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);
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
This implementation currently uses a custom wire protocol so it won't be compatible with other gRPC named pipe implementations.