error catching

This commit is contained in:
shinichi
2020-10-16 10:51:45 +02:00
parent 813545c2da
commit 6ec09ec995
2 changed files with 2 additions and 2 deletions

View File

@@ -87,7 +87,7 @@ namespace ClientApp.Utils
/// <param name="ar">the result of the async read</param>
private void OnRead(IAsyncResult ar)
{
if (ar == null || (!ar.IsCompleted))
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead))
return;

View File

@@ -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);