TCP networking
Transmission Control Protocol (TCP) is a connection-oriented protocol that provides the following guarantees:
- Reliability: The sender will know whether the intended recipient received the data
- Ordering: Messages will be received in the order they are sent in
- Error-checked: Messages will be protected against corruption during transit
Thanks to these guarantees, TCP is relatively easy to work with. It is the basis for many higher-level protocols such as HTTP and WebSockets. In this section, we will look at some recipes that show how to write TCP servers and clients.