Operation of TCP/IP
Figure 1 indicates how these protocols are configured for communications. To make clear that the total communications facility may consist of multiple networks, the constituent networks are usually referred to as subnetworks. Some sort of network access protocol, such as the Ethernet logic, is used to connect a computer to a subnetwork. This protocol enables the host to send data across the subnetwork to another host, or, in the case of a host on another subnetwork, to a router. IP is implemented in all of the end systems and the routers. It acts as a relay to move a block of data from one host, through one or more routers, to another host. TCP is implemented only in the end systems; it keeps track of the blocks of data to ensure that all are delivered reliably to the appropriate application.
Figure 1 TCP/IP concepts.
For successful communication, every entity in the overall system must have a unique address. Actually, two levels of addressing are needed. Each host on a subnetwork must have a unique global Internet address; this allows the data to be delivered to the proper host. This address is used by IP for routing and delivery. Each application within a host must have an address that's unique within the host; this allows the host-to-host protocol (TCP) to deliver data to the proper process. These latter addresses are known as ports.
Let's trace a simple operation. Suppose that an application, associated with port 1 at host A, wants to send a message to another application, associated with port 2 at host B. The application at A hands the message down to TCP with instructions to send it to host B, port 12. TCP hands the message down to IP with instructions to send it to host B. Note that IP need not be told the identity of the destination port. All it needs to know is that the data is intended for host B. Next, IP hands the message down to the network access layer (such as Ethernet logic) with instructions to send it to router J (the first hop on the way to B).
To control this operation, control information as well as user data must be transmitted, as suggested in Figure 2. Let's say that the sending process generates a block of data and passes this to TCP. TCP may break this block into smaller pieces to make it more manageable. To each of these pieces, TCP appends control information known as the TCP header, forming a TCP segment. The control information is to be used by the peer TCP protocol entity at host B. Examples of fields that are part of this header include the following:
Destination port: When the TCP entity at B receives the segment, it must know to whom the data is to be delivered.
Sequence number: TCP numbers the segments that it sends to a particular destination port sequentially, so that if they arrive out of order, the TCP entity at B can reorder them.
Checksum: The sending TCP includes a code that's a function of the contents of the remainder of the segment. The receiving TCP performs the same calculation and compares the result with the incoming code. A discrepancy results if there has been some error in transmission.
Figure 2 Protocol data units (PDUs) in the TCP/IP architecture.
Next, TCP hands each segment over to IP, with instructions to transmit it to B. These segments must be transmitted across one or more subnetworks and relayed through one or more intermediate routers. This operation, too, requires the use of control information. Thus, IP appends a header of control information to each segment to form an IP datagram. An example of an item stored in the IP header is the destination host address (in this example, B).
Finally, each IP datagram is presented to the network access layer for transmission across the first subnetwork in its journey to the destination. The network access layer appends its own header, creating a packet or frame. The packet is transmitted across the subnetwork to router J. The packet header contains the information that the subnetwork needs to transfer the data across the subnetwork. Examples of items that may be contained in this header include the following:
Destination subnetwork address: The subnetwork must know to which attached device the packet is to be delivered.
Facilities requests: The network access protocol might request the use of certain subnetwork facilities, such as priority.
At router J, the packet header is stripped off and the IP header examined. On the basis of the destination address information in the IP header, the IP module in the router directs the datagram out across subnetwork 2 to B. To do this, the datagram is again augmented with a network access header.
When the data is received at B, the reverse process occurs. At each layer, the corresponding header is removed, and the remainder is passed on to the next higher layer, until the original user data is delivered to the destination application.