diff --git a/Class/AsyncTcpServer.cs b/Class/AsyncTcpServer.cs index 692853b..41e0c0b 100644 --- a/Class/AsyncTcpServer.cs +++ b/Class/AsyncTcpServer.cs @@ -24,7 +24,10 @@ namespace ForwardingServerUI.Class public required string SERRVERPASWORD { get; set; } public required string MachineVer { get; set; } } + + private static Timer? _timer; public static TcpService service = new TcpService(); + public static async Task TcpMain() { //TcpService service = new TcpService(); @@ -157,9 +160,10 @@ namespace ForwardingServerUI.Class Console.WriteLine("TcpServer:Run"); - Timer timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(90), TimeSpan.FromSeconds(30)); + //启动检查循环定时器 + _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(90), TimeSpan.FromSeconds(30)); } - + private static async void TimerCallback(object? state) { try