book
book copied to clipboard
TCP is not a request-response protocol
- I have searched open and closed issues and pull requests for duplicates, using these search terms:
- yes
- I have checked the latest
mainbranch to see if this has already been fixed, in this file:- yes
URL to the section(s) of the book with this problem: https://github.com/rust-lang/book/blob/main/src/ch20-01-single-threaded.md?plain=1 Description of the problem:
The two main protocols involved in web servers are *Hypertext Transfer
Protocol* *(HTTP)* and *Transmission Control Protocol* *(TCP)*. Both protocols
are *request-response* protocols, meaning a *client* initiates requests and a
*server* listens to the requests and provides a response to the client. The
contents of those requests and responses are defined by the protocols.
Suggested fix:
The two main protocols involved in web servers are *Hypertext Transfer
Protocol* *(HTTP)* and *Transmission Control Protocol* *(TCP)*. HTTP
is a *request-response* protocol, meaning a *client* initiates requests and
a *server* listens to the requests and provides a response to the client. The
contents of those requests and responses are defined by the HTTP protocol.
Yes, Transmission Control Protocol (TCP) is a connection-oriented protocol rather than request-response protocol as TCP is a lower level protocol (transport layer protocol) in more technical sense. It is also discussed here (stackoverflow): Does TCP has Response code system like HTTP response
While a TCP socket is not a request-response protocol in the same sense that HTTP is, you cannot even start sending application-level messages across it without a request and a response: the handshake. Likewise, closing the socket also normally uses a handshake, which involves something it is perfectly reasonable to describe as a request and response pattern. (Note that this is a high-level description, not a specification!) As such, I am going to go ahead and close this issue and the corresponding PR as it is correct at the level of detail the book is addressing. Thanks!