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 1.0 kB

3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435
  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. {
  18. Services = { AvailableService.BindService(gameServer) },
  19. Ports = { new ServerPort("127.0.0.1", 8888, ServerCredentials.Insecure) }
  20. };
  21. server.Start();
  22. Console.WriteLine("Server begins to listen!");
  23. gameServer.WaitForEnd();
  24. Console.WriteLine("Server end!");
  25. server.ShutdownAsync().Wait();
  26. }
  27. catch (Exception ex)
  28. {
  29. Console.WriteLine(ex.ToString());
  30. }
  31. }
  32. }
  33. }