The diagram below shows us the the four main layers of the TCP/IP model
The TCP/IP layer is divided into four distinct layers. Each layer of the TCP/IP has a specific functionality attached to it and each layer is completely separate from the other layers. The data moves in a bottom-up fashion from layer 4 to 3 to 2 then to 1 and the information sent travels in a top-down manner from 1 to 2 to 3 and then finally to layer 4. We will now look at the functionality of each of the layers individually.
The application layer is responsible for providing network services to the various applications that use the TCP/IP protocol. Some of the application network protocols that are a part of this layer are HyperText Transfer Protocol (HTTP), Simple Mail Transport Protocol (SMTP) and File Transfer Protocol (FTP).
The sockets and port numbers of this layer are used to differentiate the path and sessions at which the applications operate. Most application layer protocols, especially on the server side, have specially allocated port numbers, e.g. HTTP = 80 and SMTP = 25, and FTP = 20 (Control), 21 (Data).
The main functionality of this layer is proper, seamless transmission of the data. The predominant protocols that operate at this layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). TCP is the protocol that is more favourable because it is considered to be the most reliable transmission protocol and it guarantees safe transmission of data without any unnecessary packet loss. UDP, on the other hand, is not as complex as TCP. UDP is not designed to be reliable or guarantee data delivery. UDP is more useful for faster transfer of data without carrying out post checks to verify whether the data has successfully arrived at the destination.
The Internet Layer
This layer contains the packet description which includes the origin and destination of the data. This is stored in the form of the Internet Protocol (IP) which describes a packet that contains a source IP Address, destination IP Address and the actual data to be delivered.
Network Access Layer
This is the lowest level of the TCP/IP protocol stack and functions carried out here include encapsulation of IP packets into frames for transmission, mapping IP addresses to physical hardware addresses (MAC Addresses) and the use of protocols for the physical transmission of data.