This commit is contained in:
2023-10-06 14:17:20 +09:00
parent a3a0cc201b
commit c699009897
3 changed files with 13 additions and 5 deletions

View File

@@ -50,10 +50,11 @@ namespace ConsoleApp.TelnetSamples
byte[] readBuffer = new byte[1024];
while (true)
{
if (_cts != null && _cts.IsCancellationRequested)
//Thread.Sleep(100);
if (_cts.IsCancellationRequested)
break;
int bytesRead = _cts != null && _cts.IsCancellationRequested ? 0 : await _socket.ReceiveAsync(readBuffer);
int bytesRead = await _socket.ReceiveAsync(readBuffer);
if (bytesRead < 1)
{
if (sb.Length > 0 && this.MessageCallback != null)