Transport Control Protocol – TCP Reliable and Connection-Oriented

Transport control Protocol

TCP- Transport control Protocol

Transport control Protocol (TCP) is a transport layer protocol (OSI Model – Layer4) is a reliable and connection-oriented that sends data as an unstructured stream of bytes to hosts over the IP Network such as LAN, WAN and Internet.

TCP provide delivery notification after sending each segment to the node with delivery information about packets transmitted to a destination node. TCP re-transmit the data segment if data lost in transit from source to destination.

TCP can also identify duplicate messages and will discard them appropriately. If the sending computer is transmitting too fast to receiving computer, TCP can use flow control mechanisms to slow data transfer. All these characteristics makes TCP an end-to-end reliable transport protocol

TCP/IP protocol suite, was designed in 1970s by 2 DARPA scientists—Vint Cerf and Bob Kahn, persons most often called the fathers of the Internet.

TCP Protocol is an open standard internet protocol and independent working with IP layer. It also known as Internet suit transport protocol. TCP is one of the main protocols in TCP/IP networks Layer.

Today, every organization is enabled with TCP protocol for communication and every single network device, Application, Apps, Mobile Devices and Cloud are leverage with TCP technology.

TCP is defined by the Internet Engineering Task Force (IETF) in the Request for Comment (RFC) standards document number RFC#793.


TCP/IP Suits Protocols

TCP protocol used almost anything where you have to get all transmitted data. When people refer to “TCP/IP” remember that they are talking about a suite of protocols and not just one protocol, like most people think.Few Very common protocols that use TCP are.

Example -:  FTP, SSH, Telnet, HTTP, HTTPS, DNS, SMTP and POP3….!!!


TCP Features

Here are the main features of the TCP that we are going to analyses:

Open Standard (Multi-Vendor Support) TCP is an Internet standards protocol. It is not a vendor specific.

Reliable Transport – TCP is a reliable transport layer protocols and provide end to end delivery. TCP established connection between hosts before transport the data.

Flow Control – TCP uses an end-to-end flow control protocol to avoid having the sender send data too fast for the TCP receiver to receive and process it reliably.

Windowing – Sliding windows, a technique also known as windowing, is used by the Internet’s Transmission Control Protocol (TCP) as a method of controlling the flow of packets between two computers or network hosts. TCP requires that all transmitted data be acknowledged by the receiving host. Sliding windows is a method by which multiple packets of data can be affirmed with a single acknowledgment.

Error Detection – TCP provide Error detection while transmission .TCP use Sequence numbers allow receivers to discard duplicate packets and properly sequence reordered packets. Acknowledgments allow senders to determine when to re-transmit lost packets.

Congestion control – TCP congestion control is main aspect of transmission. TCP uses a number of mechanisms to achieve high performance and avoid congestion collapse. These mechanisms control the rate of data entering the network, keeping the data flow below a rate that would trigger collapse.

TCP Header Format

TCP header length is a minimum of 20 bytes and a maximum of 60 bytes which allowing for up to 40 bytes of options in the header. TCP Header consist of different TCP field values and Flag are describe as below-:

TCP Header Format

0—————————————————32 Bytes——————————————-31

Source Port (16 bit)Destination Port (16 bit)
Sequence Number (32 bit)
Acknowledgment Number (32 bit)
Data Offset (4 bit)Reserved (6 bit)Control Bits (6 bit)Window (16 bit)
Checksum (16 bit)Urgent Pointer (16 bit)
Options (variable)Padding (variable)
Data

 

Source Port: 16 bits

Source port Define the port number of source application.

Destination Port: 16 bits

Source port Define the port number of Destination application.

Sequence Number: 32 bits

The sequence number of the first data octet in this segment (except when SYN is present). If SYN is present the sequence number is the initial sequence number (ISN) and the first data octet is ISN+1.

Acknowledgment Number: 32 bits

If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive.  Once a connection is established this is always sent.

Data Offset: 4 bits

The number of 32 bit words in the TCP Header.  This indicates where the data begins.  The TCP header (even one including options) is an integral number of 32 bits long.

Reserved: 6 bits

Reserved for future use.  Must be zero.

Control Bits: 6 bits 

  1.     URG:  Urgent Pointer field significant
  2.     ACK:  Acknowledgment field significant
  3.     PSH:  Push Function
  4.     RST:  Reset the connection
  5.     SYN:  Synchronize sequence numbers
  6.     FIN:  No more data from sender

Window: 16-bit

This is the number of bytes, starting with the one specified by the acknowledgment number field, that the receiver is willing to accept. This is a 16-bit field, limiting the window to 65535 bytes.

Checksum: 16-bit

This covers both the header and the data. It is calculated by prepending a pseudo-header to the TCP segment, this consists of three 32 bit words which contain the source and destination IP addresses, a byte set to 0, a byte set to 6 (the protocol number for TCP in an IP datagram header) and the segment length (in words).

The 16-bit one’s complement sum of the header is calculated (i.e., the entire pseudo-header is considered a sequence of 16-bit words). The 16-bit one’s complement of this sum is stored in the checksum field. This is a mandatory field that must be calculated and stored by the sender, and then verified by the receiver.

Urgent Pointer: 16-bit

The urgent pointer is valid only if the URG flag is set. This field communicates the current value of the urgent pointer as a positive offset from the sequence number in this segment.

The urgent pointer points to the sequence number of the octet following the urgent data.  This field is only be interpreted in segments with the URG control bit set.

Options: variable

Options may occupy space at the end of the TCP header and are a multiple of 8 bits in length.  All options are included in the checksum. An option may begin on any octet boundary.  There are two    cases for the format of an option:

Case 1:  A single octet of option-kind.

Case 2:  An octet of option-kind, an octet of option-length, and the actual option-data octets.

Padding: variable

The TCP header padding is used to ensure that the TCP header ends and data begins on a 32 bit boundary.  The padding is composed of zeros.

Data : This field contains a segment of data from the user application, such as part of an email or web page.

TCP Three-way Handshake

TCP Three-way handshake used to established reliable connection between client and server.

A three-way handshake (SYN, SYN-ACK, ACK) is a method used in a TCP/IP network to create a connection between a local host/client and server. TCP use three-step method in order to establish the reliable connection between client and server to exchange SYN and ACK (acknowledgment) packets before actual data communication begins.

TCP 3-Way Handshake Diagram

Below is a simplified diagram of the TCP Three-way handshake process. Please see the below at the diagram as you examine the list of events happened during the TCP Three-way Handshake.

tcp-3wayhandhake

  1. Client Computer Send – TCP SYN Packet to Server
  2. Server receives – SYN Packet.
  3. Server sends a SYN – ACK Packet to Client
  4. Client Computer receives – SYN-ACK
  5. Client Computer sends – ACK Packet to Server
  6. Server receives – ACK.

TCP SOCKET CONNECTION IS ESTABLISHED BETWEEN CLIENT AND SERVER.

Author: Ronnie Singh

5 thoughts on “Transport Control Protocol – TCP Reliable and Connection-Oriented

Your Feedback is Valuable for us. Pls do comments.