1 #region Copyright notice and license 2 // Copyright 2015 gRPC authors. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 #endregion 16 17 using System; 18 using System.Threading.Tasks; 19 using Grpc.Core; 20 21 namespace Math 22 { 23 class MainClass 24 { 25 const string Host = "0.0.0.0"; 26 const int Port = 23456; 27 Main(string[] args)28 public static async Task Main(string[] args) 29 { 30 Server server = new Server 31 { 32 Services = { Math.BindService(new MathServiceImpl()) }, 33 Ports = { { Host, Port, ServerCredentials.Insecure } } 34 }; 35 server.Start(); 36 37 Console.WriteLine("MathServer listening on port " + Port); 38 39 Console.WriteLine("Press any key to stop the server..."); 40 Console.ReadKey(); 41 42 await server.ShutdownAsync(); 43 } 44 } 45 } 46