通信协议是半双工还是全双工?

Are communication protocol Half-duplex or Full-duplex?

我知道有很多不同的comminucation protocals,例如:http, tcp, ssh, socks5, SMTP, POP,等等

我也知道要实现通信,我们需要连接localhost:localportremotehost:remoteport。例如,如果我们 google 某物,我们会连接一个随机本地 portwww.google.com: 80。如果我们 ssh 一个远程主机,我们会连接一个随机本地 portremotehost: 22

我的问题是:通信协议是半双工还是全双工

我猜答案是Half-duplex。因为我认为在 http 连接中,首先我们将请求从 localhost:localport 发送到 remotehost:80,然后远程服务器将其响应从 remotehost:80 发送到 localhost:localport .同样,在ssh连接中,首先我们向远程主机发送ssh命令,远程主机收到命令后,做一些事情并将结果返回给本地主机。

所以我认为在 localhost:localportremotehost:remoteport 之间的一个连接中,消息要么从 localhost:localport 发送到 remotehost:remoteport,要么从 remotehost:remoteport 发送到localhost:localport.

我说得对吗?

this article 中所述:

SSH is a bidirectional full duplex protocol, which means that it’s not synchronous like HTTP where you need to send a message for a response to happen.
With SSH the remote host might want to tell you something even if you have remained silent. This connector uses a callback flow approach to decouple the “sending” operation from the “receiving” operation.

如文档所述in this IETF draft,大多数实现确实允许全双工 HTTP(对于 2xx 响应)。

Full-duplex HTTP follows the basic HTTP request-response semantics but also allows the server to send response body to the client at the same time when the client is transmitting request body to the server.

Requirements for full-duplex HTTP are under-specified in the existing HTTP (Hypertext Transfer Protocol -- HTTP/1.1) specification, and this memo intends to clarify the requirements of full-duplex HTTP on top of the basic HTTP protocol semantics.