Home » Technology » Transmission Control Protocol (TCP)

Transmission Control Protocol (TCP)

  • What does Transmission Control Protocol (TCP) mean?
  • TCP (Transmission Control Protocol) is one of the transport layer protocols of the TCP / IP protocol suite.
  • In advanced computer networks, the TCP protocol has been written to provide lossless data transmission in packet switched computer communications. The most popular protocols for HTTP, HTTPS, POP3, SSH, SMTP, Telnet and FTP are made via TCP.

 

  • TCP History
  • First, in May 1974, an article entitled “A Protocol for Packet Network Intercommunication” was published by the Institute of Electrical and Electronics Engineers (IEEE). The authors of this article read in this article; Vint Cerf and Bob Khan define a network protocol that uses the “packet-switching” method to provide resource sharing between nodes on a network. They characterized this protocol model as packet switched and the basis of TCP was thrown.
  • TCP / IP was originally designed to meet the US DoD’s need for data communications. By the end of the 1960s, the Advanced Research Projects Agency (ARPA), working under the US Department of Defense, began to work with universities in the United States to find a protocol independent of the manufacturer’s brand to exchange data over the network. Participants set up ARPANET as a result of these studies. ARPANET was the first packet-switched network on the Internet. ARPANET first started working on four nodes in late 1969. As a result of the success of this work, the first wide area network called “ARPA Internet (ARPANET)” was established.

 

  • Working Principles
  • The working principle of TCP can be examined under three phases:
  • 1) First, a connection with the target occurs.
  • 2) After the connection is made, the data is transferred.
  • 3) After the data transfer, the connection is terminated.
  • In TCP, some intermediate states are defined for these three phases to occur. These situations are as follows:

 

  • LISTEN
  • (Server) The state in which a TCP connection request is expected by the client

 

  • SYN-SENT
  • (Client) Waiting for a response from the opposite party to the connection request after sending the TCP connection request to the opposite party

 

  • SYN-RECEIVED
  • (Server) Waiting status after the client responds with a SYN-ACK flag to the connection request made by the SYN flag

 

  • ESTABLISHED
  • (Server and client) Status after the connection is established

 

  • FIN-WAIT-1
  • (Server and client)

 

  • FIN-WAIT-2
  • (Server and client) is waiting for the request to finish the TCP connection from the other side

 

  • CLOSE-WAIT
  • (Server and client)

 

  • CLOSING
  • (Server and client) Waiting for the end of the connection after sending an ACK flag to terminate the connection to the other side

 

  • LAST-ACK
  • (Server and client)

 

 

 

 

 

  • TIME-WAIT
  • (Server and client)

 

  • CLOSED
  • (Server and client) TCP connection is completely finished

 

  • How to set up TCP connection
  • When computer A wants to connect to computer B via TCP, the following path is followed:
  • A computer sends a TCP SYNCHRONIZE message to computer B
  • B sends a TCP SYN + ACKnowledgement message to the computer that the computer receives the request
  • A computer sends a TCP ACK message to computer B
  • B computer receives an ACK “TCP connection is ESTABLISHED” message

 

  • This method, called a three-way handshake, is the result of a TCP connection being opened.

 

  • Data transmission
  • After the connection is established, B begins to receive packets from the computer. B, after waiting for a while after each received packet, notifies the last properly received packet group to A. According to incoming notifications, A then decides and routes which packets to send. The lost packets (or packet receipt information) are sent again and again.

 

  • Terminating the TCP connection
  • At the end of the data communication, any one of the computers sends a TCP shutdown message to the other. The other computer will ask you to confirm the shutdown package and shut down. Finally, the other computer also sends the shutdown confirmation and the connection is closed.

 

  • Here are the exact steps:
  • A computer sends a TCP FIN message to the computer B that it wants to terminate the connection to.
  • B sends a TCP ACK message to the computer that it has received a connection termination request to the computer.
  • B sends a TCP FIN message to the computer that wants to terminate the connection to the computer.
  • A computer sends a TCP ACK message to the computer B that it has received a connection termination request.
  • At the end of these operations, the TCP connection is terminated. This is called a 4-time handshake.

 

  • As you can see, unlike establishing a connection, the connection is turned off for each device separately. The reason for this is to ensure that the connection can be kept open one-way when requested. For this, one side has to implement the closing steps.

 

  • TCP Segmentation
  • TCP is a connection-oriented protocol. For two computers, triple handshaking (3-way handshaking) is done since the TCP is a connection-based protocol, and then the data exchange begins.
  • TCP inserts header information in front of each segment by splitting the data into pieces at the transport layer. This header along with header information is called ‘TCP Segmentation‘.

 

  • TCP is a connection-oriented protocol. For two computers, triple handshaking (3-way handshaking) is done since the TCP is a connection-based protocol, and then the data exchange begins.
  • TCP inserts header information in front of each segment by splitting the data into pieces at the transport layer. This header along with header information is called ‘TCP Segmentation‘.

 

  • Structure of the TCP Segment
  • TCP Header
Offsets Octet 0 1 2 3
Octet Bit  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
0 0 Source port Destination port
4 32 Sequence number
8 64 Acknowledgment number (if ACK set)
12 96 Data offset Reserved
0 0 0
N
S
C
W
R
E
C
E
U
R
G
A
C
K
P
S
H
R
S
T
S
Y
N
F
I
N
Window Size
16 128 Checksum Urgent pointer (if URG set)
20
160
...
Options (if data offset > 5. Padded at the end with “0” bytes if necessary.)

 

  • Source Port: The TCP port used by the sending computer.
  • Destination Port: The TCP port of the destination computer.
  • Sequence Number: The number assigned to each segment of TCP by which the data is discontinued.
  • Acknowledgment Number (ACK Number): The acknowledgment message corresponding to a SYN packet received is sent with the ACK bit.
  • Header Length / Data Offset: Displays the length of the TCP header.
  • Reserved: Reserved for future use.
  • Code Bits or Flags: Contains control information about the segment.
  • Window: Used for flow control.
  • Error Check Bits (Checksum): Used to check if the segment has reached incorrectly.
  • Urgent Pointer: Used when urgent data needs to be transmitted.
  • Option: Overflows the maximum size of the TCP segment.
  • Data : The portion of the data.
Transmission Control Protocol (TCP)
Author: wik Date: 10:53 pm
Technology


Wik's Random Content