两个单向连接是一个双向连接吗?

发布于 2024-12-02 02:47:29 字数 228 浏览 7 评论 0原文

我刚刚讨论了两种类型的“联系”。假设我们有一个服务器和一个客户端。如果两者互为服务器和客户端怎么办,这是双向的吗?

我的印象是,两个单向连接与一个双向连接有些不同,因为它们不使用相同的会话/相同的电缆/相同的任何东西。

你会说什么,有没有更通用的方法来描述存在/不存在这种差异?

PS:搜索刚刚显示数据库讨论。

PPS:不知何故单向不能用作标签,有足够声誉的人可以创建它吗?

I just had a discussion about the two types of "connections". Lets say we have a server and a client. What if both are server and client for each other, is this bidirectional?

I was under the impression that the two unidirectional connections are somewhat different from one bidirectional because they don't use the same session/ same cable/ same whatever.

What would you say, is there a more general way to describe that there is / is not such a difference?

P.S.: A search just showed up database discussions.

P.P.S.: somehow unidirectional is not available as a tag, could someone with enough reputation create it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一花一树开 2024-12-09 02:47:29

在许多情况下,双向连接在逻辑上与两个单向连接不同,因为它暗示两个数据流之间的因果关系。虽然在极少数情况下,使用一种将独立输入和管道封装成双向连接的类型可能会很有用,但一般来说,两个管道应作为一个单元保存和使用,除非在某些情况下可能会出现这种情况。有时想要使用单个双向连接的输入和输出端,但有时想要使用一个连接的输入端和另一个连接的输出端(例如,程序可能默认将 stdin 和 stdout 连接到输入端和输出端单个套接字,但可能允许其中一个或两个在其他地方连接)。

用最简单的话来说,我建议如果一个程序期望它的输入不依赖于它的输出(就像“sort”或“grep”这样的情况),那么输入和输出应该是独立的对象;如果程序期望输入将取决于其输出(例如,它将发出请求并期望读取响应),则输入和输出应由双向连接对象处理。

A bidirectional connection is in many cases logically different from two unidirectional connections, since it implies a causal relationship between the two data flows. While there may be some rare occasions when it would be useful to have a type which encapsulates independent input and pipes into a bidirectional connection, in general the two pipes should be held and used as a single unit unless there is some scenario in which one might sometimes want to use the input and output sides of a single bidirectional connection but sometimes want to use the input side of one connection and the output side of another (e.g. a program might default to having stdin and stdout connected to the input- and output sides of a single socket, but might allow either or both to be connected elsewhere).

In simplest terms, I would suggest that if a program is expecting that its input will not depend upon its output (as would be the case with something like "sort" or "grep"), the input and output should be independent objects; if the program is expecting that the input will depend upon its output (e.g. it will send out a request and expect to read a response), the input and output should be handled by a bidirectional-connection object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文