更新
更旧
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
public class EchoConnectionHandler : ConnectionHandler
var result = await connection.Transport.Input.ReadAsync();
var buffer = result.Buffer;
if (!buffer.IsEmpty)
{
await connection.Transport.Output.WriteAsync(buffer.ToArray());
}
else if (result.IsCompleted)
{
break;
}
connection.Transport.Input.AdvanceTo(result.Buffer.End);