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.cs16
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/csharp/route_guide/RouteGuideServer/Program.cs b/examples/csharp/route_guide/RouteGuideServer/Program.cs
index e00b4d6723..0a4d73f391 100644
--- a/examples/csharp/route_guide/RouteGuideServer/Program.cs
+++ b/examples/csharp/route_guide/RouteGuideServer/Program.cs
@@ -5,26 +5,28 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace examples
+namespace Examples
{
class Program
{
static void Main(string[] args)
{
+ const int Port = 50052;
+
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 server = new Server
+ {
+ Services = { RouteGuide.BindService(new RouteGuideImpl(features)) },
+ Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
+ };
server.Start();
- Console.WriteLine("RouteGuide server listening on port " + port);
+ Console.WriteLine("RouteGuide server listening on port " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
- GrpcEnvironment.Shutdown();
}
}
}