Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created September 8, 2017 05:38
Show Gist options
  • Save matiasinsaurralde/e3f947a5c5e702ceb66d8f993e0a7832 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/e3f947a5c5e702ceb66d8f993e0a7832 to your computer and use it in GitHub Desktop.
Program.cs
using System;
using Grpc.Core;
namespace tyk_plugin
{
class Program
{
// Port to attach the gRPC server to:
const int Port = 5555;
static void Main(string[] args)
{
// We initialize a Grpc.Core.Server and attach our dispatcher implementation to it:
Server server = new Server
{
Services = { Coprocess.Dispatcher.BindService(new DispatcherImpl()) },
Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
};
server.Start();
Console.WriteLine("gRPC server listening on " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment