Example #1
0
        static void Main(string[] args)
        {
            var service = new Service();
            var server  = new Grpc.Core.Server {
                Services = { Pricefeed.BindService(service) },
                Ports    = { new ServerPort("localhost", 12345, ServerCredentials.Insecure) },
            };

            var cancel = new CancellationTokenSource();

            server.Start();

            Console.WriteLine("Server is running!");
            Console.ReadLine();
            cancel.Cancel();
            server.ShutdownAsync().Wait();
        }
Example #2
0
        static void Main(string[] args)
        {
            var channel = new Channel("127.0.0.1:12345", ChannelCredentials.Insecure);
            var client  = new Pricefeed.PricefeedClient(channel);

            var service = new Service(client);
            var server  = new Server {
                Services = { Pricefeed.BindService(service) },
                Ports    = { new ServerPort("localhost", 12346, ServerCredentials.Insecure) },
            };

            server.Start();
            Console.WriteLine("Proxy is running!");
            Console.ReadLine();
            Console.WriteLine("Proxy is shutting down...");
            server.ShutdownAsync().Wait();
        }