From 59a812011b3e4d042a39a38c91b975004a0f3f49 Mon Sep 17 00:00:00 2001 From: Blank Date: Mon, 9 Sep 2024 17:42:01 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]1.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E6=94=B6=E5=88=B0=E7=A9=BA=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99,=E9=9C=80=E8=A6=81=E6=94=B6?= =?UTF-8?q?=E5=88=B0=E5=85=B6=E4=BB=96=E6=B6=88=E6=81=AF=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E6=89=8D=E4=BC=9A=E8=A7=A6=E5=8F=91=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NetworkManager.SystemTcpNetworkChannel.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Runtime/Network/Network/SystemSocket/NetworkManager.SystemTcpNetworkChannel.cs b/Runtime/Network/Network/SystemSocket/NetworkManager.SystemTcpNetworkChannel.cs index dbe4ca5..6d22d3c 100644 --- a/Runtime/Network/Network/SystemSocket/NetworkManager.SystemTcpNetworkChannel.cs +++ b/Runtime/Network/Network/SystemSocket/NetworkManager.SystemTcpNetworkChannel.cs @@ -123,7 +123,7 @@ private void ReceiveCallback(IAsyncResult asyncResult) throw; } - if (bytesReceived <= 0 && !PReceiveState.IsEmptyBody) + if (bytesReceived <= 0) { Close(); return; @@ -150,6 +150,13 @@ private void ReceiveCallback(IAsyncResult asyncResult) else { processSuccess = ProcessPackHeader(); + if (PReceiveState.IsEmptyBody) + { + // 如果是空消息,直接返回 + ProcessPackBody(); + ReceiveAsync(); + return; + } } if (processSuccess)