aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/csharp/route_guide/RouteGuideServer/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/csharp/route_guide/RouteGuideServer/Program.cs')
-rw-r--r--examples/csharp/route_guide/RouteGuideServer/Program.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/csharp/route_guide/RouteGuideServer/Program.cs b/examples/csharp/route_guide/RouteGuideServer/Program.cs
new file mode 100644
index 0000000000..e00b4d6723
--- /dev/null
+++ b/examples/csharp/route_guide/RouteGuideServer/Program.cs
@@ -0,0 +1,30 @@
+using Grpc.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace examples
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ var features = RouteGuideUtil.ParseFeatures(RouteGuideUtil.DefaultFeaturesFile);
+ GrpcEnvironment.Initialize();
+
+ Server server = new Server();
+ server.AddServiceDefinition(RouteGuide.BindService(new RouteGuideImpl(features)));
+ int port = server.AddListeningPort("localhost", 50052);
+ server.Start();
+
+ Console.WriteLine("RouteGuide server listening on port " + port);
+ Console.WriteLine("Press any key to stop the server...");
+ Console.ReadKey();
+
+ server.ShutdownAsync().Wait();
+ GrpcEnvironment.Shutdown();
+ }
+ }
+}