Coming to the 2nd Transport Layer Protocol i.e. Transmission Control Protocol(TCP). The Transmission Control Protocol(TCP) is such an important protocol in the Internet protocol model, that the whole Internet stack is called as the TCP/IP stack. TCP was 1st introduced in 1974.
A number of applications use TCP for their execution such as HTTP, FTP, SMTP. Web Browser uses TCP to connect to the World Wide Web (www). TCP is used to deliver emails and transfer files from one host to another.
TCP is called as Connection-Oriented Protocol. Because in TCP, there is a 3-way handshake between the communicating hosts before exchanging the data or the message. There are lots of services provided by TCP that were not available by UDP. TCP provides Reliable Delivery of data, checks for error in the data and tries for its correction and delivers the packet in their respective order as they were sent by the sender. It also provides congestion control and flow control.
TCP provides a full-duplex mode of transmission i.e. if there is a connection between a Process Y on one host and a Process Z on another host. Then the Application message can be sent from Process Y to Process Z and from Process Z to Process Y within the same TCP connection.
A TCP connection is between a single sender and a single receiver. It means TCP is a point-to-point connection control protocol. Multi-casting is not possible with TCP. Multi-casting is a procedure of sending of data from a single sender to different receiver in a single send operation.
Problems with Transmission Control Protocol(TCP):
Due to large traffic and congestion in the network, packets might get lost or they can get corrupt. TCP being the reliable data delivery protocol, detects all these problems, try to resolve them, asks for the re-transmission of the lost or corrupt packets, arranges the packet in order and send them to the receiver. The TCP receiver arranges all these packets in order and send them to the Application.
Thus in all this, re-transmissions , in order packet delivery, sometimes TCP results in long delays.
How TCP provides Reliable delivery of data :
TCP does it by a process of positive Acknowledgement. The receiver has to acknowledge the sender by sending a message to the sender, if it has receive the data correctly. The sender keeps the record of every packet it sends and maintains a clock with every packet. If the acknowledgement doesn’t comes before the clock expires, the sender will re-transmit that packet, assuming that the packet is either lost or corrupted.
TCP Packet Structure:
1. Source Port Number: It is used to identify the sending port number.
2. Destination Port Number: It is used to identify the receiving port Number.
3. Sequence Number and Acknowledgement Number : These are used for the reliable Delivery of data. Each Sequence and Acknowledgement Number is of 32 bits.
4. Header Length : This field is of 4 bytes. It tells the length of the TCP Header. The TCP header can be of variable lengths due to the presence of Option Fields. (In most cases, option field is empty, then the TCP header length is 20 bytes).
5. Unused or Reserved : This is reserved for future use. It is of 3 bit.
- ACK: This bit is used to indicate that whether the value in Acknowledgement field is valid or not. That means, whether it contains an acknowledgment number for a packet that has been successfully received.
- RST, SYN and FIN : These 3 bits are used for establishing a connection between and to stop a connection.
- PSH : This bit indicates whether the data should be pass to the upper layer or not. If PSH=1, it indicates the receiver should pass the data immediately to the upper layer.
- URG: This bit is used to indicate , if there is any data , that the host has marked as urgent. If URG=1, then it shows that some data has been marked as urgent. To know the address of that Urgent data, the 16-bit Urgent Data Pointer field is used which gives that information.
7. Checksum: It is of 16 bits. It is used to check that whether the data has arrived correctly or not. It is also used to detect any error in the data.
8. Application Message: It is of 32 bits. It contains the actual Application that the user wants to transmit.
9. Options : This field is of 32 bits. If the user need to send a data that is larger that the Application Message field size, then option field is used by the TCP header.
- It is recommended that you must send small packets, because if the packet size is larger, than the packet fragmentation will take place at the network layer, resulting in more number of lost packets.
i) TCP TAHOE
iii) TCP VEGAS
Concept of Sequence Number and Acknowledgement Number
First of all, I would like to tell you that, TCP Sequence and Acknowledgement Number doesn’t hold the size or number of the transmitted packet, instead they contain the byte stream of those packets. That means Sequence and Acknowledgement number contains the 1st byte of the transmitted packet.
The sender and the receiver decides on , what should be the starting sequence number of the 1st packet.
- MSS refers to the maximum size of a TCP packet that can be sent.
All the packets arriving from James has a sequence number for the data flowing from James to Steve. Now the Acknowledgement number that Steve puts in its packet is the sequence number of the next packet, that Steve is expecting from James.
Thus , I would like to bring the fact to you that, Computer networking doesn’t impose any restriction on this. It totally depends on the people programming the TCP implementation. They can choose either of these:
1. The receiver can discard the out-of-order packet as soon as he receives it.
2. The receiver can save the out of order packet in its buffer and waits for the missing packet to arrive.
- Hopefully maximum people will choose the 2nd option , in order to use the network bandwidth to the maximum, and to shorten the delay process. In Internet, the 2nd choice is used .
*****There are various interesting cases, where you sometimes have to re-transmit and sometimes you need not re-transmit a packet due to acknowledgement. Lets have a look at these scenarios.*****
Scenario 1: Re-transmission due to lost Acknowledgement :
Scene 2: Cumulative Acknowledgment avoids re-transmission of the 1st packet.
Suppose, sender sends a packet of 15 bytes and a packet of 20 bytes back to back and they are received at the receivers side and the receiver sends an acknowledgement for the same. But the acknowledgement for the 1st packet is lost in the network. But before the timeout occurs, the sender receives an acknowledgement for the 2nd packet. Thus, the sender will understand, that the sender has received all the packets till Sequence number 54. Hence it will not resend the 1st packet.
Thank You for reading the article. We hope you enjoyed it.
This is all from us on Transmission Control Protocol(TCP). Do you have something to share with our readers ?