From 707bdde29bb6dbfd582b0f7f3217040719ddaa59 Mon Sep 17 00:00:00 2001 From: Xoen <15290725@qq.com> Date: Wed, 25 Oct 2023 15:00:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Code/Scripts/Framework/Net/NetTcp.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ProjectNLD/Assets/Code/Scripts/Framework/Net/NetTcp.cs b/ProjectNLD/Assets/Code/Scripts/Framework/Net/NetTcp.cs index 98d5d9e6239..4e62af53405 100644 --- a/ProjectNLD/Assets/Code/Scripts/Framework/Net/NetTcp.cs +++ b/ProjectNLD/Assets/Code/Scripts/Framework/Net/NetTcp.cs @@ -376,7 +376,16 @@ namespace Framework try { int nReceiveLength = m_Socket.EndReceive(iar); - OnReceiveData(nReceiveLength); + if(nReceiveLength > 0) + { + OnReceiveData(nReceiveLength); + Receive(); + } + else + { + Close(); + PushEventError(NetError.Recv); + } } catch (SocketException e) { @@ -399,7 +408,7 @@ namespace Framework return; } - Receive(); + } private int GetPackageLength(byte[] buffer,