Beispiel #1
0
        static void Main(string[] args)
        {
            Server server = null;

            try
            {
                server = new Server()
                {
                    Services =
                    {
                        CalcService.BindService(new CalcServiceImpl())
                    },
                    Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
                };

                server.Start();
                Console.WriteLine("The server is listening on the port : " + Port);
                Console.ReadKey();
            }
            catch (IOException e)
            {
                Console.WriteLine("The server failed to start : " + e.Message);
                throw;
            }
            finally
            {
                if (server != null)
                {
                    server.ShutdownAsync().Wait();
                }
            }
        }
Beispiel #2
0
 public CalcServerManager()
 {
     _server = new Server
     {
         Services = { CalcService.BindService(new CalcServiceImplementation()) },
         Ports    = { new ServerPort("localhost", 1234, ServerCredentials.Insecure) }
     };
 }