public static void Main(string[] args) { // Build server var server = new Server { Services = { PingPongService.BindService(new PingPongServiceImpl()) }, Ports = { new ServerPort(Host, Port, ServerCredentials.Insecure) } }; // Start server server.Start(); Console.WriteLine("Ping Pong server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); }
static void Main(string[] args) { try { string resposta; do { PingPongService.ExecutarNovaPartida(); Console.WriteLine("Deseja jogar mais uma partida? (S/N)"); resposta = Console.ReadLine(); Console.WriteLine(); }while (string.IsNullOrEmpty(resposta) || resposta.Equals("S", StringComparison.InvariantCultureIgnoreCase)); } catch (Exception e) { Console.WriteLine(e); Console.Read(); } }