diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs index 7a4dd03..e292e0e 100644 --- a/ClientApp/Utils/Client.cs +++ b/ClientApp/Utils/Client.cs @@ -87,7 +87,7 @@ namespace ClientApp.Utils /// the result of the async read private void OnRead(IAsyncResult ar) { - if (ar == null || (!ar.IsCompleted)) + if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead)) return; diff --git a/Server/Client.cs b/Server/Client.cs index 07cd69d..3843f52 100644 --- a/Server/Client.cs +++ b/Server/Client.cs @@ -34,7 +34,7 @@ namespace Server private void OnRead(IAsyncResult ar) { - if (ar == null || (!ar.IsCompleted)) + if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead)) return; int receivedBytes = this.stream.EndRead(ar);