0

 TCP(Transmission Control Protocol):

English Version:
        
When ever you try to send any data or start a connection between two devices there is two defined protocols Transmission Control Protocol(TCP) or User Datagram Protocol(UDP). TCP is a connection oriented protocol, which maintain its connection with other end device till the end of the transmission. TCP works on TRANSPORT LAYER of OSI and TCP/IP protocols. TCP is slower compare to UDP because TCP supports Acknowledgement of Packets. TCP also supports flow control, error checking, full duplex connection, and end to end communication.

Hindi Version:

Jab bhi ham koi data bhejna chahate hai ya kisi device ke bech me connection banana chahate hai toh hamare paas do tarha ke protocols hai ek ka naam hai TCP transmission control protocol aur dusra UDP user datagram protocol. TCP connection oriented protocol hai matlab wo dusri device se data pura pahunchne tak connection qayam rakhta hai. aur ye OSI aur TCP ke transport layer par kaam karta hai, TCP protocol slow hai UDP se keu ke TCP har packet dusre end par pahunchne par acknowledgement mangta hai dusre end se ke packet pahuncha ya nahi. TCP flow control, error checking , full duplex connection aur end to end communication bhi support karta hai.

TCP Header:


                                 
TCP Header consists of minimum 20 bytes and maximum 60 bytes. In header we have the following fields
        To understand the source and destination port no you have to know about port numbers, port numbers are used by different applications or services to send or receive data over internet. there are total 0-65535 or 2 power 16 port numbers. In 65535 there are 0-1023 known port numbers means they are reserved for services like http, dns, smtp, ftp, telnet etc.

➤ Some known port numbers:

        1. FTP = 21
        2. SSH = 22
        3. SMTP = 25
        4. DNS = 53
        5. HTTP = 80
        6. POP3 = 110
        7. IMAP4 = 143
        8. HTTPS = 443

1. Source port no: 

when an application request to server, a port number will be assigned to that request known as source port no.

2.Destination port no: 

on receiver side also the application request is received through a port no which is known as Destination port no.

3. Sequence Number: 

When application layer sends data to transport layer, it collects data bits and convert that data bits into bytes. after converting into bytes it creates a segment, segment is collection of bytes. so in segment each byte is counted and assigned a random sequence number.

4. Acknowledge no:

 Acknowledge no is a reply from receiver's side. let's take an example to understand the concept of acknowledge no.

                                      1. Sender sends 10 bytes of data
                                      2. Transport layer receives data and assigned random sequence number 101 to 110
                                      3. After receiving the data receiver sends an acknowledgement no 111
Acknowledgement no is always x+1, while x is the sequence no of sender's last byte.

5. Header Length: 

Header length consists of 4 bits. it shows total length but from the 4 bits we can only get 4 numbers 0000 or 1111 so here we use binary to decimal format but still if we convert 1111 into decimal still we will get value of 15, so we use scale of 4 here whatever value we get we have to multiply with 4. Let's take an example. 

     1. Header length (1100) = convert binary to decimal 1100 = 8+4+0+0 = 12 multiply with 4 = 48 bytes   
     2. Header length (1000) = convert binary to decimal 1000 = 8+0+0+0 = 8 multiply with 4 = 32 bytes
     3. Header length (0010) = 0010 = 0+0+2+0 = 2 X 4 = 8 bytes ( incorrect header length) 
Minimum header length:
      4. Header length (0101) = convert 0101 to binary = 0+4+0+1 = 5 X 4 = 20 bytes.

6. Reserved bits: 

this 6 bits are reserved for future purpose.

            TCP FLAGS:

7. Urgent flag: 

while sending data if some data is urgent to send, then sender use this flag to show that there is some urgent data.

8. ACK Flag: 

If there is an acknowledgement in the header we use this flag to show there is an acknowledgement.

9. Push Flag: 

when data is received by the receiver, it stores data in buffer for some time and  when buffer is full receiver sends that data to receiver application layer. but if we don't want to hold data into buffer we use this flag.  

10. Reset Flag:

sometimes we need to reset connection throughout transmission so we use this flag.

11. SYN Flag:

whenever we send first byte of data we use syn flag to know this is the first byte and client wants to initiate the connection. 

12. FIN Flag: 

when we send last byte of data we use fin flag to know this is the last byte and client wants to terminate the connection.

13. Window size: 

when sender establish a connection with receiver, sender sends its capacity of receiving data in window size to receiver. Also  receiver sends its capacity of receiving data in window size to sender. by this we can able to manage flow control.

14. Checksum: 

it helps in error control.

15. Urgent pointer: 

when we use urgent flag in urgent pointer we show where is the urgent data and what is the range of urgent data.

16. Options and Padding: 

extra data in header also we use MSS(maximum segment size) in options.
            maximum segment size is the size of segment in a network. each network has their own MSS value.         
TCP Handshake:

            

TCP uses three way handshake to initiate connection. First client sends a SYN message to server, server reply back with SYN-ACK message, and again client sends ACK message to complete the three way handshake process. Below is the three way handshake example of accessing www.google.com.

1. First host 10.0.3.15 sends a SYN message with following details Seq no, Window size, MSS size etc.
2. Google server 172.217.163.196 reply back to host with SYN-ACK message with following details seq no, Ack no, Window size etc.
3. Last host 10.0.3.15 reply back to sever ACK message to complete three way handshake. 

TCP explained in hindi part 1:


TCP Explained in Hindi part 2:



TCP Explained in Hindi via wireshark live scenario part 3:




################################### Thank You ########################################

Post a Comment

 
Top