1.2 Overview of TCP/IP Protocol Usage

Applications developed for TCP/IP generally use several of the protocols in the suite. The layers of the protocol suite is also known as the protocol stack. User applications communicate with the top layer of the protocol suite. The top-level protocol layer on the source computer passes information to the lower layers of the stack, which in turn pass it to the physical network. The physical network transfers the information to the destination computer. The lower layers of the protocol stack on the destination computer pass the information to higher layers, which in turn pass it to the destination application.

Each protocol layer within the TCP/IP suite has various functions; these functions are independent of the other layers. Each layer, however, expects to receive specific services from the layer beneath it, and each layer provides specific services to the layer above it.

Figure 1-2 shows the TCP/IP protocol layers. The layers at the same level on the source and destination computers are peers. For example, the application on the source computer and the application on the destination computer are peers. Each layer of the protocol stack on the source computer communicates with its peer layer on the destination computer. From the perspective of the software developer or user, the transfer takes place as if the peer layers sent their packets directly to one another.

Figure 1-2 TCP/IP Model

The corresponding layers on the TCP/IP model

For example, An application for transferring files with TCP performs the following operations to send the file contents:

  1. The Application layer passes a stream of bytes to the Transport layer on the source computer.

  2. The Transport layer divides the stream into TCP segments, adds a header with a sequence number for that segment, and passes the segment to the Internet (IP) layer. A checksum is computed over the TCP header and data.

  3. The IP layer creates a packet with a data portion containing the TCP segment. The IP layer adds a packet header containing source and destination IP addresses.

  4. The IP layer also determines the physical address of the destination computer or intermediate computer on the way to the destination host. It passes the packet and the physical address to the Data-Link layer. A checksum is computed on the IP header.

  5. The Data-Link layer transmits the IP packet in the data portion of a data-link frame to the destination computer or an intermediate computer. If the packet is sent to an intermediate computer, steps 4 through 7 are repeated until the destination computer is reached.

  6. At the destination computer, the Data-Link layer discards the data-link header and passes the IP packet to the IP layer.

  7. The IP layer checks the IP packet header. If the checksum contained in the header does not match the checksum computed by the IP layer, it discards the packet.

  8. If the checksums match, the IP layer passes the TCP segment to the TCP layer.

  9. The TCP layer computes a checksum for the TCP header and data. If the computed checksum does not match the checksum transmitted in the header, the TCP layer discards the segment. If the checksum is correct and the segment is in the correct sequence, the TCP layer sends an acknowledgment to the source computer and passes the data to the application.

  10. The application on the destination computer receives a stream of bytes, just as if it were directly connected to the application on the source computer.