SlideShare a Scribd company logo
Overview

TCP = Transmission Control Protocol
• Connection-oriented protocol
• Provides a reliable unicast end-to-end byte stream over an
  unreliable internetwork.
                   Byte Stream




                                                     Byte Stream
                 TCP                               TCP




                                 IP Internetwork


                                                                   1
Connection-Oriented

• Before any data transfer, TCP establishes a connection:
       • One TCP entity is waiting for a connection (“server”)
       • The other TCP entity (“client”) contacts the server
• The actual procedure for setting up connections is more
  complex.
• Each connection is CLIENT                              SERVER
                                 Request a connection
  full duplex
                                                            waiting for
                                                           connection
                                    Accept a connection
                                                              request

                     Data Transer
                                              Disconnect




                                                                          2
Reliable

• Byte stream is broken up into chunks which are called seg-
ments

   • Receiver sends acknowledgements (ACKs) for segments

   • TCP maintains a timer. If an ACK is not received in time,
     the segment is retransmitted

•Detecting errors:

   • TCP has checksums for header and data. Segments with
     invalid checksums are discarded

   • Each byte that is transmitted has a sequence number

                                                                 3
Byte Stream Service

• To the lower layers, TCP handles data in blocks, the
  segments.
• To the higher layers TCP handles data as a sequence of
  bytes and does not identify boundaries between bytes
• So: Higher layers do not know about the beginning and
       end of segments !
                             Application                                        Application
                                                                     1. read 40 bytes
                  1. write 100 bytes                                 2. read 40 bytes
                  2. write 20 bytes                                  3. read 40 bytes




                                           queue of                                           queue of
                                           bytes to be                                        bytes that
                                                         Segments
                 TCP                       transmitted              TCP                       have been
                                                                                              received




                                                                                                           4
TCP Format
• TCP segments have a 20 byte header with >= 0 bytes of data.

            IP header               TCP header                                                TCP data
               20 bytes                    20 bytes

                            0                                          15 16                               31

                                    Source Port Number                           Destination Port Number

                                                   Sequence number (32 bits)




                                                                                                                20 bytes
                                      Acknowledgement number (32 bits)
                          header
                           length
                                               0            Flags                        window size
                                     TCP checksum                                     urgent pointer
                                                              Options (if any)

                                                                        DATA


                                                                                                                           5
TCP header fields

• Port Number:
     • A port number identifies the endpoint of a connection.
     • A pair <IP address, port number> identifies one
       endpoint of a connection.
     • Two pairs <client IP address, server port number>
       and <server IP address, server port number> identify
       a TCP connection.
                    Applications              Applications




           Ports:       23     80       104        7     80       16   Ports:
                              TCP                       TCP


                                   IP                        IP



                                                                                6
TCP header fields

• Sequence Number (SeqNo):
   – Sequence number is 32 bits long.
   – So the range of SeqNo is
        0 <= SeqNo <= 232 -1 ≈ 4.3 Gbyte
   – Each sequence number identifies a byte in the byte
     stream
   – Initial Sequence Number (ISN) of a connection is set
     during connection establishment




                                                            7
TCP header fields

• Acknowledgement Number (AckNo):
   – Acknowledgements are piggybacked, I.e
       a segment from A -> B can contain an
       acknowledgement for a data sent in the B -> A direction



   – A hosts uses the AckNo field to send acknowledgements.
     (If a host sends an AckNo in a segment it sets the “ACK flag”)
   – The AckNo contains the next SeqNo that a hosts wants to
     receive
     Example: The acknowledgement for a segment with
              sequence numbers 0-1500 is AckNo=1501
                                                                      8
TCP header fields

• Acknowledge Number (cont’d)
   – TCP uses the sliding window flow protocol to regulate the
     flow of traffic from sender to receiver
   – TCP uses the following variation of sliding window:
        – no NACKs (Negative ACKnowledgement)
        – only cumulative ACKs
• Example:
   Assume: Sender sends two segments with “1..1500” and
     “1501..3000”, but receiver only gets the second segment.
   In this case, the receiver cannot acknowledge the second
     packet. It can only send AckNo=1


                                                                 9
TCP header fields

• Header Length ( 4bits):
   – Length of header in 32-bit words
   – Note that TCP header has variable length (with minimum
     20 bytes)




                                                              10
TCP header fields

• Flag bits:
   – URG: Urgent pointer is valid
       – If the bit is set, the following bytes contain an urgent message in
         the range:
          SeqNo <= urgent message <= SeqNo+urgent pointer
  – ACK: Acknowledgement Number is valid
  – PSH: PUSH Flag
       – Notification from sender to the receiver that the receiver should
         pass all data that it has to the application.
       – Normally set by sender when the sender’s buffer is empty




                                                                          11
TCP header fields

• Flag bits:
   – RST: Reset the connection
       – The flag causes the receiver to reset the connection
       – Receiver of a RST terminates the connection and indicates
         higher layer application about the reset
  – SYN: Synchronize sequence numbers
       – Sent in the first packet when initiating a connection
  – FIN: Sender is finished with sending
       – Used for closing a connection
       – Both sides of a connection must send a FIN




                                                                     12
TCP header fields

• Window Size:
   – Each side of the connection advertises the window size
   – Window size is the maximum number of bytes that a
     receiver can accept.
   – Maximum window size is 216-1= 65535 bytes
• TCP Checksum:
   – TCP checksum covers over both TCP header and TCP
     data (also covers some parts of the IP header)
• Urgent Pointer:
   – Only valid if URG flag is set


                                                              13

More Related Content

What's hot (20)

PPT
Features of tcp (part 2) .68
myrajendra
 
PPTX
Tcp ip presentation
Satya P. Joshi
 
PDF
Transport layer services
Melvin Cabatuan
 
PPT
Tcpip 1
myrajendra
 
PPT
Ports & sockets
myrajendra
 
PPT
Tcp Udp
Eri Alam
 
PPTX
Week4 lec1-bscs1
syedhaiderraza
 
PDF
Computer network (16)
NYversity
 
PPTX
Part 12 : Local Area Networks
Olivier Bonaventure
 
PPT
Chap 12 tcp
Sparsh Samir
 
PDF
Custom_IP_Network_Protocol_and_Router
Vishal Vasudev
 
PPT
Tcp ip
Akshay Nagpurkar
 
PDF
Introduction to TCP
Pradeep Kumar TS
 
DOCX
Surviving The Stump The Chump Interview Questions
Duane Bodle
 
PPTX
Part 7 : HTTP/2, UDP and TCP
Olivier Bonaventure
 
PPT
An overview of TCP (Transmission Control Protocol)
Ammad Marwat
 
PPTX
TCP/IP 3-way Handshake
Alok Tripathi
 
PPTX
Tcp
Varsha Kumar
 
PPTX
Multipath TCP
Olivier Bonaventure
 
Features of tcp (part 2) .68
myrajendra
 
Tcp ip presentation
Satya P. Joshi
 
Transport layer services
Melvin Cabatuan
 
Tcpip 1
myrajendra
 
Ports & sockets
myrajendra
 
Tcp Udp
Eri Alam
 
Week4 lec1-bscs1
syedhaiderraza
 
Computer network (16)
NYversity
 
Part 12 : Local Area Networks
Olivier Bonaventure
 
Chap 12 tcp
Sparsh Samir
 
Custom_IP_Network_Protocol_and_Router
Vishal Vasudev
 
Introduction to TCP
Pradeep Kumar TS
 
Surviving The Stump The Chump Interview Questions
Duane Bodle
 
Part 7 : HTTP/2, UDP and TCP
Olivier Bonaventure
 
An overview of TCP (Transmission Control Protocol)
Ammad Marwat
 
TCP/IP 3-way Handshake
Alok Tripathi
 
Multipath TCP
Olivier Bonaventure
 

Similar to Computer network (Lecture 2) (20)

PPT
Eshcol tech solutions pvt ltd
Ojas Kumar
 
PPT
Olumide pidan b
Amit Ranjan
 
PPT
Transport protocols
Online
 
PPT
Unit III IPV6 UDP
sangusajjan
 
PPT
TCP Part I How does it work - module13-tcp1.ppt
JeanLuc86
 
PPTX
Transport_Layer_Protocols.pptx
AnkitKumar891632
 
PDF
Transmission control protocol tcp tcp tcp tcp
DeepaThilakK
 
PPTX
COMPUTER NETWORKS - TCP GATE COACHING QUESTIONS
KRISHNAVENISITTeachi
 
PPT
Transmission control protocol ...............................
SwatiHans10
 
PDF
Networking problem help Consider the following TCP session between h.pdf
FashionBoutiquedelhi
 
PPT
TCP _
SwatiHans10
 
PPT
Transmission control protocol _
SwatiHans10
 
PDF
Multi Process Message Formats
Pathfinder Solutions
 
PPT
Chapter 01 - Overview
phanleson
 
PPT
TCPIP in brief and working operation.ppt
Mugabo4
 
PDF
Internet technology unit 3
WE-IT TUTORIALS
 
PPTX
Unit-4 (1).pptx
poonamsngr
 
Eshcol tech solutions pvt ltd
Ojas Kumar
 
Olumide pidan b
Amit Ranjan
 
Transport protocols
Online
 
Unit III IPV6 UDP
sangusajjan
 
TCP Part I How does it work - module13-tcp1.ppt
JeanLuc86
 
Transport_Layer_Protocols.pptx
AnkitKumar891632
 
Transmission control protocol tcp tcp tcp tcp
DeepaThilakK
 
COMPUTER NETWORKS - TCP GATE COACHING QUESTIONS
KRISHNAVENISITTeachi
 
Transmission control protocol ...............................
SwatiHans10
 
Networking problem help Consider the following TCP session between h.pdf
FashionBoutiquedelhi
 
Transmission control protocol _
SwatiHans10
 
Multi Process Message Formats
Pathfinder Solutions
 
Chapter 01 - Overview
phanleson
 
TCPIP in brief and working operation.ppt
Mugabo4
 
Internet technology unit 3
WE-IT TUTORIALS
 
Unit-4 (1).pptx
poonamsngr
 
Ad

Recently uploaded (20)

PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPTX
How to Manage Promotions in Odoo 18 Sales
Celine George
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPTX
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PPTX
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
How to Create Rental Orders in Odoo 18 Rental
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
How to Manage Promotions in Odoo 18 Sales
Celine George
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
How to Configure Access Rights of Manufacturing Orders in Odoo 18 Manufacturing
Celine George
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
Explorando Recursos do Summer '25: Dicas Essenciais - 02
Mauricio Alexandre Silva
 
Ad

Computer network (Lecture 2)

  • 1. Overview TCP = Transmission Control Protocol • Connection-oriented protocol • Provides a reliable unicast end-to-end byte stream over an unreliable internetwork. Byte Stream Byte Stream TCP TCP IP Internetwork 1
  • 2. Connection-Oriented • Before any data transfer, TCP establishes a connection: • One TCP entity is waiting for a connection (“server”) • The other TCP entity (“client”) contacts the server • The actual procedure for setting up connections is more complex. • Each connection is CLIENT SERVER Request a connection full duplex waiting for connection Accept a connection request Data Transer Disconnect 2
  • 3. Reliable • Byte stream is broken up into chunks which are called seg- ments • Receiver sends acknowledgements (ACKs) for segments • TCP maintains a timer. If an ACK is not received in time, the segment is retransmitted •Detecting errors: • TCP has checksums for header and data. Segments with invalid checksums are discarded • Each byte that is transmitted has a sequence number 3
  • 4. Byte Stream Service • To the lower layers, TCP handles data in blocks, the segments. • To the higher layers TCP handles data as a sequence of bytes and does not identify boundaries between bytes • So: Higher layers do not know about the beginning and end of segments ! Application Application 1. read 40 bytes 1. write 100 bytes 2. read 40 bytes 2. write 20 bytes 3. read 40 bytes queue of queue of bytes to be bytes that Segments TCP transmitted TCP have been received 4
  • 5. TCP Format • TCP segments have a 20 byte header with >= 0 bytes of data. IP header TCP header TCP data 20 bytes 20 bytes 0 15 16 31 Source Port Number Destination Port Number Sequence number (32 bits) 20 bytes Acknowledgement number (32 bits) header length 0 Flags window size TCP checksum urgent pointer Options (if any) DATA 5
  • 6. TCP header fields • Port Number: • A port number identifies the endpoint of a connection. • A pair <IP address, port number> identifies one endpoint of a connection. • Two pairs <client IP address, server port number> and <server IP address, server port number> identify a TCP connection. Applications Applications Ports: 23 80 104 7 80 16 Ports: TCP TCP IP IP 6
  • 7. TCP header fields • Sequence Number (SeqNo): – Sequence number is 32 bits long. – So the range of SeqNo is 0 <= SeqNo <= 232 -1 ≈ 4.3 Gbyte – Each sequence number identifies a byte in the byte stream – Initial Sequence Number (ISN) of a connection is set during connection establishment 7
  • 8. TCP header fields • Acknowledgement Number (AckNo): – Acknowledgements are piggybacked, I.e a segment from A -> B can contain an acknowledgement for a data sent in the B -> A direction – A hosts uses the AckNo field to send acknowledgements. (If a host sends an AckNo in a segment it sets the “ACK flag”) – The AckNo contains the next SeqNo that a hosts wants to receive Example: The acknowledgement for a segment with sequence numbers 0-1500 is AckNo=1501 8
  • 9. TCP header fields • Acknowledge Number (cont’d) – TCP uses the sliding window flow protocol to regulate the flow of traffic from sender to receiver – TCP uses the following variation of sliding window: – no NACKs (Negative ACKnowledgement) – only cumulative ACKs • Example: Assume: Sender sends two segments with “1..1500” and “1501..3000”, but receiver only gets the second segment. In this case, the receiver cannot acknowledge the second packet. It can only send AckNo=1 9
  • 10. TCP header fields • Header Length ( 4bits): – Length of header in 32-bit words – Note that TCP header has variable length (with minimum 20 bytes) 10
  • 11. TCP header fields • Flag bits: – URG: Urgent pointer is valid – If the bit is set, the following bytes contain an urgent message in the range: SeqNo <= urgent message <= SeqNo+urgent pointer – ACK: Acknowledgement Number is valid – PSH: PUSH Flag – Notification from sender to the receiver that the receiver should pass all data that it has to the application. – Normally set by sender when the sender’s buffer is empty 11
  • 12. TCP header fields • Flag bits: – RST: Reset the connection – The flag causes the receiver to reset the connection – Receiver of a RST terminates the connection and indicates higher layer application about the reset – SYN: Synchronize sequence numbers – Sent in the first packet when initiating a connection – FIN: Sender is finished with sending – Used for closing a connection – Both sides of a connection must send a FIN 12
  • 13. TCP header fields • Window Size: – Each side of the connection advertises the window size – Window size is the maximum number of bytes that a receiver can accept. – Maximum window size is 216-1= 65535 bytes • TCP Checksum: – TCP checksum covers over both TCP header and TCP data (also covers some parts of the IP header) • Urgent Pointer: – Only valid if URG flag is set 13