What is TCP (Transmission Control Protocol)?
TCP is a standard, which defines how to establish and maintain a network conversation through which application programs can exchange data. TCP works with the Internet Protocol (IP), which defines how computers send packets of data to each other over the internet. The Internet Engineering Task Force (IETF) defines TCP in the Request for Comment (RFC) standards document 793. The Transmission Control Protocol (TCP) is offered to use as a highly reliable, host-to-host protocol among hosts in packet-switched computer communication networks, and in interconnected systems of such networks.
1. TCP is one of the fundamental protocols of the Internet Protocol (IP) suite
2. TCP is a connection-oriented, end-to-end reliable protocol designed to fit in a layered hierarchy of protocols that supports multi-network applications.
3. The TCP offers reliable inter-process communication between pairs of processes in host computers attached to distinct but interconnected computer communication networks.
4. Very few assumptions are made for the reliability of the communication protocols below the TCP layer. TCP assumes that it can obtain a simple, potentially unreliable datagram service from the lower level protocols.
5. TCP is able to operate above a wide spectrum of communication systems, ranging from hard-wired connection to packet-switched or circuit-switched networks.
6. TCP is a connection-oriented protocol, which means a connection is established and maintained until the application programs at each end have finished the exchange of messages.
7. It determines how to break application data into small packets of information that networks can deliver. Controls sending of data packets to the network layer and receiving of data packets from the network layer hence manages flow control. It is meant to provide error-free data transmission, handles retransmission of dropped or corrupted packets as well as acknowledgment of all packets that arrive.
Structure of the TCP/IP model
Functionally it is divided into four layers, each of which includes the following:
Fig. TCP/IP Protocol Layers
1. Application layer: It is the topmost layer. The application layer provides an application with standard data exchange. It includes HTTP, FTP, Post Office Protocol 3 (POP3), protocols. Simple Mail Transfer Protocol (SMTP) and Simple Network Management Protocol (SNMP) also. At the application layer, the payload is actually the application data.
2. Transport layer: this layer is responsible for maintaining end-to-end communication across the network. TCP handles communications between hosts and provides flow control, multiplexing of data and reliability. The transport layer protocol includes TCP and User Datagram Protocol (UDP), which is sometimes used instead of TCP in special cases.
3. Network layer: It is also called the internet layer, it deals with packets and connects independent networks to transport layer packets across network boundaries. The network layer protocols are Internet protocol and (IP) and the Internet Control Message Protocol (ICMP) that is used for error reporting.
4. Physical layer: It is also known as the network interface layer or data link layer (dll).It consists of protocols that operate only on a link and network component that interconnects nodes or hosts in the network. The protocols in this layer include Ethernet for local area networks (LANs) and the Address Resolution Protocol (ARP). The physical layer is the lowest layer of the model.
How Transmission Control Protocol works
For transferring a file with TCP over the internet following steps are performed.
1. The application layer passes a stream of bytes to its lower layer, the Transport layer on the source computer.
2. The transport layer divides the stream of data into TCP segments, adds a header to each segment with a sequence number for that segment, and passes it to the Internet (IP) layer. A checksum is calculated over the TCP header and data.
3. Next, the IP layer creates a packet with a data portion holding the TCP segment. The IP layer again adds a packet header containing source and destination IP addresses.
4. The IP layer also defines 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 part of the data-link frame to the destination computer or any intermediate computer. If the packet is sent to an intermediate computer, steps 4,5,6 7 are repeated until the destination computer is reached.
6. At the destination side computer, the Data-Link layer discards the data-link header and passes the IP packet to the IP layer.
7. Next, the IP layer checks the IP packet header. If the checksum hold in the header does not match the checksum calculated by the IP layer, it discards the packet.
If the checksums is match, the IP layer passes the TCP segment to TCP layer.
TCP layer calculates a checksum for TCP header and data. If the calculated checksum does not match the checksum transmitted in the header part, the TCP layer discards the particular segment. If the checksum is correctly matched 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 layer.
The application layer on the destination computer receives a stream of bytes, just as if it were directly associated with the application on the source computer.
Fig. TCP frame structure
Why TCP is important: TCP/IP is non-proprietary and so, as a result, is not governed by any single company. Therefore, the Internet Protocol Suite can be modified easily. It is well-suited with all operating systems, so it can communicate with any other system easily. The Internet Protocol Suite is also compatible with all types of computer hardware and networks.TCP/IP is highly accessible and, as a routable protocol, it can determine the most efficient path through the network. It is widely used in current internet architecture.
Fig. A comparison of the OSI model and the TCP/IP model.