You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 997 B

3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334
  1. using Grpc.Core;
  2. using Protobuf;
  3. using System.Threading;
  4. using Timothy.FrameRateTask;
  5. using System;
  6. using System.Net.Http.Headers;
  7. namespace Server
  8. {
  9. public class Program
  10. {
  11. public static void Main()
  12. {
  13. try
  14. {
  15. GameServer gameServer = new();
  16. Grpc.Core.Server server = new Grpc.Core.Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) }) {
  17. Services = { AvailableService.BindService(gameServer) },
  18. Ports = { new ServerPort("127.0.0.1", 8888, ServerCredentials.Insecure) }
  19. };
  20. server.Start();
  21. Console.WriteLine("Server begins to listen!");
  22. gameServer.WaitForEnd();
  23. Console.WriteLine("Server end!");
  24. server.ShutdownAsync().Wait();
  25. }
  26. catch (Exception ex)
  27. {
  28. Console.WriteLine(ex.ToString());
  29. }
  30. }
  31. }
  32. }