What is TCP Protocol?
The TCP protocol is Transmission Control Protocol which lies between the Application layer and network layer used to provide reliable stream delivery service i.e. deliver data as a stream of bytes, also receive data as a stream of bytes. TCP uses acknowledge mechanism to check the safe and sound arrival of data, performs multiplexing at the sender side and demultiplexing at the receiver end. To achieve connection orientation feature, TCP uses three phases like connection establishment, data transfer, and connection termination.
Understanding TCP Protocol
It is considered as a connection-oriented protocol which means that connection is established as well as maintained until the time application programs at each of the end are done exchanging messages. It also decides how to break the application data in the form of packets which the networks deliver, then send packets and finally accept those packets from the network layer, and in addition also manage flow control. In the OSI model, TCP occupies parts of Layer 4, which is, Transport Layer, and also parts of Layer 5 which are Session Layer.
Let us take an example. When the webserver sends an HTML file to the client, it makes use of the HTTP protocol. The HTTP program layer then requests the TCP layer to set the connection and then send the file. TCP stack then divides the file in form of packets, numbers them and finally forwards them to the Internet Protocol layer to deliver. Though each of the packets in transmission has the same source as well as destination IP addresses, packets still are sent along various routes. TCP program layer in the client computer always waits until and unless all the packets have already arrived, and afterward it acknowledges the ones it has received and then it asks for the retransmission.
Advantages of TCP Protocol
- It is quite a reliable protocol.
- It also makes sure that the data is reaching the desired destination in the same order that it was sent.
- It is also connection-oriented.
- It gives an error-checking mechanism as well as a mechanism of recovery.
- It also exhibits communication that is end to end.
- Also, it gives flow control.
- Finally, this protocol exhibits server (full-duplex) which means it has the ability to perform receiver as well as senders roles.
TCP Protocol Scope
TCP header’s minimum length is 20 bytes and maximum length 60 bytes.
- Source Port: It is 16-bit and it identifies the application process’s source port on sending the device.
- Destination Port: It is also 16-bit and it identifies the application process’s destination port on receiving the device.
- Data Offset (4-bits): It is 4 bits and it mentions the size of TCP header as well as data offset in the present packet in the entire segment of TCP.
- Reserved (3-bits): Everything is set to zero by default and is reserved for future use.
- ECE: It has got two interpretations :
- In case the SYN bit is 0, it means that ECE means that the IP packet has got its congestion experience, that is, the CE bit set.
- In case the SYN bit is 1, it means that ECE means that the device is capable of ECT.
- URG: URG signifies that the Urgent Pointer field has got important data and that it should get processed.
- ACK: ACK signifies that the Acknowledgement field has got importance. In case ACK is 0, it means that the packet is not having any acknowledgment.
- PSH: When PSH is set, it means that it is requested to receive the station so as to PUSH the data whenever it comes to receiving application but without buffering it.
- RST: Reset flag has got these features :
- RST is needed to deny a connection that is incoming.
- RST is needed to reject a segment too.
- RST is needed so as to restart the connection.
- SYN: SYN flag is needed so as to set the connection between hosts.
What Can You do with TCP Protocol?
TCP Protocol works in Server or client model. The client always starts the connection and the server would either accept it or reject it. This three-way handshaking is essentially required for connection management.
The client starts the connection and then sends the segment along with the Sequence number. Then, the server would acknowledge it along with its SN (Sequence no.) and with an ACK of the segment of client that is one more as compared to the client’s Sequence number. Now, the client after getting the ACK of the segment sends an acknowledgment of the Server’s response.
Both server or client is able to send the TCP segment along with FIN flag that is set to 1. Whenever the receiving end reverts it back by Acknowledging the FIN, that particular direction of the TCP communication gets closed and then the connection gets released.
Working with TCP Protocol
TCP makes use of port numbers in order to know which application processes it needs to handover the segment of data. Alongside this, it makes use of the sequence numbers in order to synchronize along with the remote host. Every data segment is then sent as well as received along with SN’s. Sender makes sure the last of the data segment that has been received by Receiver whenever it gets the acknowledgment. The receiver is aware of the last segment that was sent by the sender by mentioning the sequence number(SN) of the most recent received packet.
Finally that we have discussed major components of the networks as well as TCP/IP we have got the needed background in order to look into quite critical issues of security. When we are aware of how networks are built, it gives us an understanding to which physical vulnerabilities are being introduced when we choose one network design over any other and knowing how are the packets formed provides us an understanding on how they are crafted to achieve a purpose. Also, we are aware of how the packets are being transmitted as well as delivered provides a good understanding of what could possibly happen to the packets.
This is a guide to What is TCP Protocol?. Here we have discussed the scope and Working along with Advantages of TCP Protocol. You may also look at the following articles to learn more –