From b84409a5fd087e2523010417ce2a5ecd7e2690c9 Mon Sep 17 00:00:00 2001 From: lishuo Date: Fri, 2 Feb 2024 15:14:26 +0800 Subject: [PATCH] =?UTF-8?q?NetCoreServer=E7=89=88=E6=9C=AC=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=88=B06.7.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OnlineUserPool.csproj | 4 ++-- Services/TcpService.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OnlineUserPool.csproj b/OnlineUserPool.csproj index 3084aa6..161f390 100644 --- a/OnlineUserPool.csproj +++ b/OnlineUserPool.csproj @@ -2,12 +2,12 @@ WinExe - netcoreapp3.1 true + net6.0-windows - + diff --git a/Services/TcpService.cs b/Services/TcpService.cs index e01f1bb..09e227a 100644 --- a/Services/TcpService.cs +++ b/Services/TcpService.cs @@ -23,9 +23,7 @@ namespace OnlineUserPool.Services public void RunServer(Action action, Action disconnected = null) { - _server = new PfTcpServer(IPAddress.Any, ConfigHelp.TcpPort, (ip, model) => { action(ip, model, this); }, - disconnected); - + _server = new PfTcpServer(IPAddress.Any, ConfigHelp.TcpPort, (ip, model) => { action(ip, model, this); },disconnected); _server.Start(); } @@ -40,6 +38,7 @@ namespace OnlineUserPool.Services if (session is { IsConnected: true }) { session.SendAsync(dgram); + dgram = null; } } @@ -180,6 +179,7 @@ namespace OnlineUserPool.Services Log.Error($"接受到的数据处理时出错:{data}\r\n{ex.Message}\r\n{ex.StackTrace}"); } + buffer = null; data = null; }