TransportStreamReadAsync(MemoryByte, CancellationToken) 方法
Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
命名空间: TouchSocket.Sockets程序集: TouchSocket (在 TouchSocket.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
public override ValueTask<int> ReadAsync(
Memory<byte> buffer,
CancellationToken cancellationToken = default
)
Public Overrides Function ReadAsync (
buffer As Memory(Of Byte),
Optional cancellationToken As CancellationToken = Nothing
) As ValueTask(Of Integer)
abstract ReadAsync :
buffer : Memory<byte> *
?cancellationToken : CancellationToken
(* Defaults:
let _cancellationToken = defaultArg cancellationToken new CancellationToken()
*)
-> ValueTask<int>
override ReadAsync :
buffer : Memory<byte> *
?cancellationToken : CancellationToken
(* Defaults:
let _cancellationToken = defaultArg cancellationToken new CancellationToken()
*)
-> ValueTask<int>
- buffer MemoryByte
- The region of memory to write the data into.
- cancellationToken CancellationToken (Optional)
- The token to monitor for cancellation requests. The default value is None.
ValueTaskInt32A task that represents the asynchronous read operation. The value of its
Result property contains the total number of bytes read into the buffer. The result value can be less than the number of bytes allocated in the buffer if that many bytes are not currently available, or it can be 0 (zero) if the end of the stream has been reached.