TCP/IP Protocol
On the internet, data exchange between two computers is based on two protocols:
- the IP protocol
- the TCP protocol
But what is a protocol?
According to Wikipedia, in the general case:
We call protocol the conventions that facilitate communication without being directly part of the subject of communication itself.
In electronics and computer science: a communication protocol is a set of constraints allowing to establish communication between two entities (in the case that interests us 2 computers).
There are many protocols that allow two computers to communicate with each other. Among these many protocols, we will study two that have fundamental importance in the functioning of the internet: the IP protocol and the TCP protocol.
From a technical point of view, the TCP and IP protocols are at the heart of the internet. They are so linked together that we often speak of the TCP/IP protocol.
When computer A "wants" to send data to computer B, after some operations that will not be covered here, computer A "uses" the TCP protocol to format the data to be sent.
Then the IP protocol takes over and uses the data formatted by the TCP protocol to create data packets. After some other operations that will also not be mentioned here, the data packets can begin their journey on the network to computer B. It is important to understand that the IP protocol "encapsulates" the data from the TCP protocol to constitute data packets.
Once they arrive at destination (computer B), the data is "de-encapsulated": we recover the TCP data contained in the packets to be able to use them.
The IP protocol only takes care of making packets arrive at destination using the IP address of the destination computer. The IP addresses of the departure computer (computer A) and destination computer (computer B) are added to the data packets.
The TCP protocol ensures that a packet has arrived at destination. Indeed when computer B receives a data packet from computer A, computer B sends an acknowledgment to computer A (somewhat like "OK, I received the packet").
If computer A does not receive this acknowledgment from B, after a predefined time, computer A will resend the data packet to computer B.
We can therefore summarize the process of sending a data packet as follows:
Note that there is also the UDP protocol which is very similar to the TCP protocol.
The big difference between UDP and TCP is that the UDP protocol does not manage acknowledgments. Data exchanges with UDP are therefore less reliable than with TCP (a "lost" packet is definitively "lost" and will not be resent) but much faster (since there is no acknowledgment to transmit).
UDP is therefore very often used for data exchanges that must be fast, but where losing a data packet from time to time is not a big problem (for example video streaming).
It is very important to understand that TCP/IP is based on the notion of data packets. If for example we want to send a file (sound, photo, video or text...) using TCP/IP, the data that constitutes this file will not be sent all at once, this data will be "cut" into several pieces and each piece will be sent in a different packet. Once all packets have arrived at destination, the original file can be reconstituted. To go from computer A to computer B, the different packets containing the data that constitutes our file, will not necessarily pass through the same route (this notion of route will be addressed later), they can take very different paths: exaggerating barely, to make the Paris-Los Angeles trip, some packets could pass through the Atlantic while others pass through the Pacific. If one of the packets does not arrive at destination, the file cannot be reconstituted, the "lost" packet must be resent by the transmitter (see the acknowledgment system described above).