The TCP/IP Stack is a model that governs how data is transmitted from one computer to another via an IP network such as the Internet.
Internet communication includes using a web browser to access a webpage from a websever, sending or downloading an email from a mail server, uploading files to a server using an FTP client, etc.
For all these Internet communications, the TCP/IP Stack is used to show the different protocols used to format data to enable its transmission between computers.
A protocol is a set of rules required for two computers to communicate over a network.
A layer is a group of protocols focusing one one stage of the data transmission.
The TCP/IP Stack consists of 4 Layers:
- Application Layer
- Transport Layer
- Internet/Network Layer
- Physical/Data/Link Layer
The application layer is used to format the data so that it can be processed by the application(e.g. web browser, email client) being used for the communication. For instance:
- HTTP and HTTPS protocols are used to access a webpage via a web-browser
- The SMTP protocol is used to send e-mails between mail servers
- The IMAP and POP3 protocols are used to retrieve emails from a mail server
- The FTP protocol is used to transfer files between two computers
Some protocols such as HTTPS are also used to make sure the data is encrypted before being transmitted (passed down to the next layer).
The transport layer is used to implement packet switching.
The purpose of this layer is to split the data being transmitted in to data packets. Each packet will have its own header with information about the packet being sent, its position in the transfer, the protocol and port used.
This layer is also responsible for checking packets when they are received. This is called Transfer Control (TCP Protocol). If a packet is missing or has been corrupted, the receiving computer will automatically ask the sending computer to resend the missing/corrupted packet.
This layer is also known as the Network layer. Each packet is assigned the IP address of the source (sending computer) and of its destination (receiving computer) so that the packet can be routed through the network/Internet.
On the Internet, data packets are being redirected by routers till they reach their destination.
This layer is also known as Physical Layer. The aim of this layer is to convert the data packets into an electric current going through a copper cable (Ethernet, Coax, Phone line, etc.), an electromagnetic radio wave (wireless transmission) or a light beam (optic fibre).
The protocols used on this layer depend on the type of connection/link used to transfer the data: e.g.
- WiFi, 3G/4G/5G, Bluetooth are examples of wireless protocols
- Ethernet and ADSL are examples of protocols used for wired communication