试图了解 IDuplexPipe
Trying to understand IDuplexPipe
我正在开发围绕 Binance's web socket stream. System.IO.Pipelines looks interesting to me because of the problems it solves 的网络套接字包装器。
我最有可能采用以下实施方式之一:
- SignalR
- BotBuilder(不确定那个项目到底是什么)
- DotNet.Interactive.PowerShell
- a project that probably got inspired by Microsoft's implementation
我无法理解 IDuplexPipe
和 Pipe
之间的区别。
The IDuplexPipe is a contract for types that support both reading and writing. For example, a network connection would be represented by an IDuplexPipe.
由于我正在处理的网络套接字包装器与 Binance 的网络套接字流相关,我假设我需要 IDuplexPipe
?
SignalR 使用 IDuplexPipe
而 DotNet.Interactive.PowerShell 仅使用 Pipe
class。你能用现实生活中的例子来说明这两者之间的区别吗,因为我真的不明白Microsoft's documentation是什么意思。
IDuplexPipe 文档:
Defines a class that provides a duplex pipe from which data can be read from and written to.
IDuplexPipe 是一个接口,代表您可以使用 PipeReader 读取和使用 PipeWriter 写入的内容。
IO.Pipelines 管道只是一个缓冲区。
您链接的文档中对此进行了解释:https://docs.microsoft.com/en-us/dotnet/standard/io/pipelines#pipe
The Pipe class can be used to create a PipeWriter/PipeReader pair. All data written into the PipeWriter is available in the PipeReader:
The PipeWriter write the data into the buffer, and the PipeReader read from it.
我正在开发围绕 Binance's web socket stream. System.IO.Pipelines looks interesting to me because of the problems it solves 的网络套接字包装器。
我最有可能采用以下实施方式之一:
- SignalR
- BotBuilder(不确定那个项目到底是什么)
- DotNet.Interactive.PowerShell
- a project that probably got inspired by Microsoft's implementation
我无法理解 IDuplexPipe
和 Pipe
之间的区别。
The IDuplexPipe is a contract for types that support both reading and writing. For example, a network connection would be represented by an IDuplexPipe.
由于我正在处理的网络套接字包装器与 Binance 的网络套接字流相关,我假设我需要 IDuplexPipe
?
SignalR 使用 IDuplexPipe
而 DotNet.Interactive.PowerShell 仅使用 Pipe
class。你能用现实生活中的例子来说明这两者之间的区别吗,因为我真的不明白Microsoft's documentation是什么意思。
IDuplexPipe 文档:
Defines a class that provides a duplex pipe from which data can be read from and written to.
IDuplexPipe 是一个接口,代表您可以使用 PipeReader 读取和使用 PipeWriter 写入的内容。
IO.Pipelines 管道只是一个缓冲区。
您链接的文档中对此进行了解释:https://docs.microsoft.com/en-us/dotnet/standard/io/pipelines#pipe
The Pipe class can be used to create a PipeWriter/PipeReader pair. All data written into the PipeWriter is available in the PipeReader: The PipeWriter write the data into the buffer, and the PipeReader read from it.