Chapter 6: TCP
Transmission Control Protocol (TCP) is a connection-oriented protocol that provides reliable and ordered delivery of data from one computer to another.
In other words, TCP is the transport protocol you use whenever you want to ensure that all the bytes you send from one point reach the other completely and in the correct order.
For these and other reasons, most protocols that you use now, such as HTTP, are built on top of TCP. When you send the HTML for a page, you want it to get to the other end in the exact form that you sent it, and if that is not possible, an error should be triggered. If even one character (byte) of the stream were to be misplaced, a browser might not be able to render the page.
Node.JS is a framework designed with the development of networked applications in mind. Today, applications in a network communicate over the transport known as TCP/IP. Therefore it’s crucial that we have an understanding about how TCP/IP basically works, and how Node.JS expresses it with its amazingly simple APIs.
First, you are going to learn the characteristics of the protocol. For example, what guarantees you have when you send a message from one computer to another using TCP. If you send two messages in a row, will they get to the other end in the order you wrote them? Understanding the protocol is essential to understanding any software that leverages it. Most of the times you connect and talk to a database like MySQL, you’re doing so over a TCP socket, for example. ...