TCP 1
Computer Network
Transmission Control Protocol (TCP)
TCP 2
Transport Layer Addressing
Addresses
Transport layer adds Port number (choose among multiple
processes running on destination host)
TCP 3
Port Numbers
•Port numbers are 16-bit integers (0  65,535)
Servers use well know ports, 0-1023 are privileged
Clients use ephemeral (short-lived) ports
•Internet Assigned Numbers Authority (IANA) maintains a list of
port number assignment
Well-known ports (0-1023)  controlled and assigned by
IANA
Registered ports (1024-49151)  IANA registers and lists
use of ports as a convenience (49151 is ¾ of 65536)
Dynamic ports (49152-65535)  ephemeral ports
For well-known port numbers, see /etc/services on a UNIX or
Linux machine
TCP 4
Socket Addressing
•Process-to-process delivery needs two identifiers
IP address and Port number
Combination of IP address and port number is called a
socket address (a socket is a communication endpoint)
Client socket address uniquely identifies client process
Server socket address uniquely identifies server process
•Transport-layer protocol needs a pair of socket addresses
Client socket address
Server socket address
For example, socket pair for a TCP connection is a 4-tuple
Local IP address, local port, and
foreign IP address, foreign port
TCP 5
Multiplexing and Demultiplexing
Multiplexing
Sender side may have
several processes that
need to send packets (but
only 1 transport-layer
protocol)
Demultiplexing
At receiver side, after
error checking and
header dropping,
transport-layer delivers
each message to
appropriate process
TCP 6
Transmission Control Protocol 1/10
•TCP must perform typical transport layer functions:
Segmentation  breaks message into packets
End-to-end error control since IP is an unreliable Service
End-to-end flow control  to avoid buffer overflow
Multiplexing and demultiplexing sessions
•TCP is [originally described in RFC 793, 1981]
Reliable
Connection-oriented  virtual circuit
Stream-oriented  users exchange streams of data
Full duplex  concurrent transfers can take place in both
directions
Buffered  TCP accepts data and transmits when appropriate
(can be overridden with “push”)
TCP 7
Transmission Control Protocol 2/10
•Reliable
requires ACK and performs retransmission
If ACK not received, retransmit and wait a longer time for
ACK. After a number of retransmissions, will give up
How long to wait for ACK?
Most common, Retransmission time = 2* RTT
TCP 8
Transmission Control Protocol 3/10
•Sequence Numbers
Associated with every byte that it sends
To detect packet loss, reordering and duplicate removal
Two fields are used sequence number and acknowledgment
number. Both refer to byte number and not segment number
Sequence number for each segment is the number of the first
byte carried in that segment
The ACK number denotes the number of the next byte that
this party expects to receive (cumulative)
If an ACK number is 5643  received all bytes from beginning up
to 5642
This acknowledges all previous bytes as received error-free
TCP 9
Transmission Control Protocol 4/10
•Sending and Receiving buffers
Senders and receivers may not produce and consume data at
same speed
2 buffers for each direction (sending and receiving buffer)
TCP 10
Transmission Control Protocol 5/10
•TCP uses a sliding window mechanism for flow control
•Sender maintains 3 pointers for each connection
Pointer to bytes sent and acknowledged
Pointer to bytes sent, but not yet acknowledged
Sender window includes bytes sent but not acknowledged
Pointer to bytes that cannot yet be sent
TCP 11
Transmission Control Protocol 6/10
•Flow Control
Tell peer exactly how many bytes it is willing to accept
(advertised window  sender can not overflow receiver buffer)
Sender window includes bytes sent but not acknowledged
Receiver window (number of empty locations in receiver buffer)
Receiver advertises window size in ACKs
Sender window <= receiver window (flow control)
Sliding sender window (without a change in receiver’s advertised
window)
Expanding sender window (receiving process consumes data faster
than it receives  receiver window size increases)
Shrinking sender window (receiving process consumes data more
slowly than it receives  receiver window size reduces)
Closing sender window (receiver advertises a window of zero)
TCP 12
Transmission Control Protocol 8/10
•Congestion Control
TCP assumes the cause of a lost segment is due to congestion
in the network
If the cause of the lost segment is congestion, retransmission of
the segment does not remove the problem, it actually aggravates
it
The network needs to tell the sender to slow down (affects the
sender window size in TCP)
Actual window size = Min (receiver window size, congestion
window size)
The congestion window is flow control imposed by the sender
The advertised window is flow control imposed by the receiver
TCP 13
Transmission Control Protocol 7/10
•Error Control
Mechanisms for detecting corrupted segments, lost segments,
out-of-order segments, and duplicated segments
Tools: checksum (corruption), ACK, and time-out (one time-
out counter per segment)
Lost segment or corrupted segment are the same situation:
segment will be retransmitted after time-out (no NACK in
TCP)
Duplicate segment (destination discards)
Out-of-order segment (destination does not acknowledge,
until it receives all segments that precede it)
Lost ACK (loss of an ACK is irrelevant, since ACK
mechanism is cumulative)
Reserved TCP Port Numbers
Port number: Service:
0 Reserved
7 Echo
17 Quote of the day
21 FTP
23 TELNET
25 SMTP
37 Time
79 Finger
80 HTTP
119 NNTP
It is connection oriented protocol so follows
following
• Provides flow and error control
• receiver can immediately handle any packet it receives
• receiver can never be overwhelmed with incoming packets.
• Three way handshaking : connection establishment , data
transfer , connection termination
Transmission control protocol Process
08/31/24 15
Dr. Prasanna Singh CN Unit-4
CSBS
Transmission control protocol            _
Establishing a TCP Connection
• The 3-way handshake
• Guarantee that both sides are ready for connection
• Allows both sides to agree on initial sequence numbers
Receive data
ACK=
x+1,seq=y
Site 1 Network Site 2
Send data
with seqno=x
Send
ACK= y+1
Receive ACK
Receive ACK
•How much data should be sent by sender to the receiver
•So that Receiver can process it …. How much data should be sent by
sender without getting acknowledgement
Data Transfer( Pushing or pulling)
08/31/24 18
Dr. Prasanna Singh CN Unit-4
CSBS
Data Transfer at the transport layer
08/31/24 19
Dr. Prasanna Singh CN Unit-4
CSBS
Closing a TCP Connection
• Applications should close a connection when they have no
more data to transmit
• Connection can be closed in either one or both directions
• Site 1 finishes transmitting data and waits for ACK from site 2
• Site 1 transmits a segment with the FIN bit set
• Site 2 acknowledges the FIN segment
• Site 2 notifies the application that no more data is coming
• Data can still be transmitted from site 2 to site 1
• Site 1 will still receive and acknowledge data from site 2
• Eventually, site 2 will finish transmitting and close its connection
• Both endpoints delete record of the connection
Closing a TCP Connection (cont)
Site 1 Network Site 2
Send FIN
seq=x
Receive FIN
Send ACK
x+1
Receive ACK (inform application)
(app closes
connection)
TCP 22
TCP Segment Format
TCP 23
TCP Header Fields 1/2
•Source Port and Destination Port
Identify processes at ends of the connection
•Control bits
TCP 24
TCP Header Fields 2/2
•Sequence Number: position of the data in the sender’s byte stream
•Acknowledgment Number: position of the byte that the source
expects to receive next (valid if ACK bit set)
•Header Length: header size in 32-bit units. Value ranges from [5-15]
•Window: advertised window size in bytes
•Urgent
defines end of urgent data (or “out-of-band”) data and start of normal data
Added to sequence number (valid only if URG bit is set)
•Checksum: 16-bit CRC (Cyclic Redundancy Check) over header
and data
•Options: up to 40 bytes of options

More Related Content

PPTX
Transport_Layer_Protocols.pptx
PPT
TCP Part I How does it work - module13-tcp1.ppt
PPTX
Transmission control protocol
PPT
TCPIP in brief and working operation.ppt
PPTX
Unit V computer network notes for study.
PPTX
tcp-ippresentation-150614172243-lva1-app6892.pptx
PDF
Osi model
Transport_Layer_Protocols.pptx
TCP Part I How does it work - module13-tcp1.ppt
Transmission control protocol
TCPIP in brief and working operation.ppt
Unit V computer network notes for study.
tcp-ippresentation-150614172243-lva1-app6892.pptx
Osi model

Similar to Transmission control protocol _ (20)

PDF
TCP - IP Presentation
PPTX
Tcp ip presentation
PPT
Olumide pidan b
PPT
Eshcol tech solutions pvt ltd
PPT
the TCP transmission control protocol
PPTX
Transmission Control Protocol_ Computer Networks
PPTX
Unit 5.Transport Layer.pptx
PPTX
Transport Layer in Computer Networks (TCP / UDP / SCTP)
PPTX
08 - COMS 525 Internet Protocols and TCPIP - TCP 1.pptx
PPTX
Networking essentials lect3
PDF
Transport Control Protocol
PPT
PPTX
6610-l14.pptx
PPT
Transmission Control Protocol (TCP) connection oriented
PPTX
Week8 lec1-bscs1
PPT
Chapter 01 - Overview
PPT
MK-PPT Chapter 5.ppt advanced computer networks
PPT
TCP/IP Basics
PPTX
Tcp3 wayhandshakeprocess
PDF
materi uas jarkom tahun ajaraan 2022.pdf
TCP - IP Presentation
Tcp ip presentation
Olumide pidan b
Eshcol tech solutions pvt ltd
the TCP transmission control protocol
Transmission Control Protocol_ Computer Networks
Unit 5.Transport Layer.pptx
Transport Layer in Computer Networks (TCP / UDP / SCTP)
08 - COMS 525 Internet Protocols and TCPIP - TCP 1.pptx
Networking essentials lect3
Transport Control Protocol
6610-l14.pptx
Transmission Control Protocol (TCP) connection oriented
Week8 lec1-bscs1
Chapter 01 - Overview
MK-PPT Chapter 5.ppt advanced computer networks
TCP/IP Basics
Tcp3 wayhandshakeprocess
materi uas jarkom tahun ajaraan 2022.pdf
Ad

More from SwatiHans10 (20)

PPT
ip addressing _
PPT
stop and wait _
PPT
PPT
subnetting _
PPT
PipelineHazards _
PPT
Pipelining _
PPTX
Mobile Customer Experience Management.pptx
PPTX
Social Web multimedia analytics goals _
PPTX
Hardwires and Microprogrammed Control ,
PPTX
Restoring Algorithm _
PPTX
Non -Restoring Algorithm _
PPTX
loops _
PPT
functions _
PDF
Instruction execution cycle _
PPT
RTL,Instruction set _
PPT
Data representation _
PPTX
CAO PPT-Lect 1 _
PPTX
CIRCULAR LINKED LIST _
PPTX
Numpy _
PPTX
Lecture 1 .
ip addressing _
stop and wait _
subnetting _
PipelineHazards _
Pipelining _
Mobile Customer Experience Management.pptx
Social Web multimedia analytics goals _
Hardwires and Microprogrammed Control ,
Restoring Algorithm _
Non -Restoring Algorithm _
loops _
functions _
Instruction execution cycle _
RTL,Instruction set _
Data representation _
CAO PPT-Lect 1 _
CIRCULAR LINKED LIST _
Numpy _
Lecture 1 .
Ad

Recently uploaded (20)

PPTX
Principal presentation for NAAC (1).pptx
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PPTX
CS6006 - CLOUD COMPUTING - Module - 1.pptx
PDF
electrical machines course file-anna university
PDF
SEH5E Unveiled: Enhancements and Key Takeaways for Certification Success
PDF
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
PPTX
AI-Reporting for Emerging Technologies(BS Computer Engineering)
PDF
20250617 - IR - Global Guide for HR - 51 pages.pdf
PDF
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
PPTX
Wireless sensor networks (WSN) SRM unit 2
PDF
Mechanics of materials week 2 rajeshwari
PDF
Project_Mgmt_Institute_-Marc Marc Marc .pdf
PDF
[jvmmeetup] next-gen integration with apache camel and quarkus.pdf
PDF
Principles of operation, construction, theory, advantages and disadvantages, ...
PDF
Research on ultrasonic sensor for TTU.pdf
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PPTX
MAD Unit - 3 User Interface and Data Management (Diploma IT)
PDF
Beginners-Guide-to-Artificial-Intelligence.pdf
PPTX
Micro1New.ppt.pptx the mai themes of micfrobiology
PPTX
Environmental studies, Moudle 3-Environmental Pollution.pptx
Principal presentation for NAAC (1).pptx
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
CS6006 - CLOUD COMPUTING - Module - 1.pptx
electrical machines course file-anna university
SEH5E Unveiled: Enhancements and Key Takeaways for Certification Success
VTU IOT LAB MANUAL (BCS701) Computer science and Engineering
AI-Reporting for Emerging Technologies(BS Computer Engineering)
20250617 - IR - Global Guide for HR - 51 pages.pdf
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
Wireless sensor networks (WSN) SRM unit 2
Mechanics of materials week 2 rajeshwari
Project_Mgmt_Institute_-Marc Marc Marc .pdf
[jvmmeetup] next-gen integration with apache camel and quarkus.pdf
Principles of operation, construction, theory, advantages and disadvantages, ...
Research on ultrasonic sensor for TTU.pdf
Computer System Architecture 3rd Edition-M Morris Mano.pdf
MAD Unit - 3 User Interface and Data Management (Diploma IT)
Beginners-Guide-to-Artificial-Intelligence.pdf
Micro1New.ppt.pptx the mai themes of micfrobiology
Environmental studies, Moudle 3-Environmental Pollution.pptx

Transmission control protocol _

  • 1. TCP 1 Computer Network Transmission Control Protocol (TCP)
  • 2. TCP 2 Transport Layer Addressing Addresses Transport layer adds Port number (choose among multiple processes running on destination host)
  • 3. TCP 3 Port Numbers •Port numbers are 16-bit integers (0  65,535) Servers use well know ports, 0-1023 are privileged Clients use ephemeral (short-lived) ports •Internet Assigned Numbers Authority (IANA) maintains a list of port number assignment Well-known ports (0-1023)  controlled and assigned by IANA Registered ports (1024-49151)  IANA registers and lists use of ports as a convenience (49151 is ¾ of 65536) Dynamic ports (49152-65535)  ephemeral ports For well-known port numbers, see /etc/services on a UNIX or Linux machine
  • 4. TCP 4 Socket Addressing •Process-to-process delivery needs two identifiers IP address and Port number Combination of IP address and port number is called a socket address (a socket is a communication endpoint) Client socket address uniquely identifies client process Server socket address uniquely identifies server process •Transport-layer protocol needs a pair of socket addresses Client socket address Server socket address For example, socket pair for a TCP connection is a 4-tuple Local IP address, local port, and foreign IP address, foreign port
  • 5. TCP 5 Multiplexing and Demultiplexing Multiplexing Sender side may have several processes that need to send packets (but only 1 transport-layer protocol) Demultiplexing At receiver side, after error checking and header dropping, transport-layer delivers each message to appropriate process
  • 6. TCP 6 Transmission Control Protocol 1/10 •TCP must perform typical transport layer functions: Segmentation  breaks message into packets End-to-end error control since IP is an unreliable Service End-to-end flow control  to avoid buffer overflow Multiplexing and demultiplexing sessions •TCP is [originally described in RFC 793, 1981] Reliable Connection-oriented  virtual circuit Stream-oriented  users exchange streams of data Full duplex  concurrent transfers can take place in both directions Buffered  TCP accepts data and transmits when appropriate (can be overridden with “push”)
  • 7. TCP 7 Transmission Control Protocol 2/10 •Reliable requires ACK and performs retransmission If ACK not received, retransmit and wait a longer time for ACK. After a number of retransmissions, will give up How long to wait for ACK? Most common, Retransmission time = 2* RTT
  • 8. TCP 8 Transmission Control Protocol 3/10 •Sequence Numbers Associated with every byte that it sends To detect packet loss, reordering and duplicate removal Two fields are used sequence number and acknowledgment number. Both refer to byte number and not segment number Sequence number for each segment is the number of the first byte carried in that segment The ACK number denotes the number of the next byte that this party expects to receive (cumulative) If an ACK number is 5643  received all bytes from beginning up to 5642 This acknowledges all previous bytes as received error-free
  • 9. TCP 9 Transmission Control Protocol 4/10 •Sending and Receiving buffers Senders and receivers may not produce and consume data at same speed 2 buffers for each direction (sending and receiving buffer)
  • 10. TCP 10 Transmission Control Protocol 5/10 •TCP uses a sliding window mechanism for flow control •Sender maintains 3 pointers for each connection Pointer to bytes sent and acknowledged Pointer to bytes sent, but not yet acknowledged Sender window includes bytes sent but not acknowledged Pointer to bytes that cannot yet be sent
  • 11. TCP 11 Transmission Control Protocol 6/10 •Flow Control Tell peer exactly how many bytes it is willing to accept (advertised window  sender can not overflow receiver buffer) Sender window includes bytes sent but not acknowledged Receiver window (number of empty locations in receiver buffer) Receiver advertises window size in ACKs Sender window <= receiver window (flow control) Sliding sender window (without a change in receiver’s advertised window) Expanding sender window (receiving process consumes data faster than it receives  receiver window size increases) Shrinking sender window (receiving process consumes data more slowly than it receives  receiver window size reduces) Closing sender window (receiver advertises a window of zero)
  • 12. TCP 12 Transmission Control Protocol 8/10 •Congestion Control TCP assumes the cause of a lost segment is due to congestion in the network If the cause of the lost segment is congestion, retransmission of the segment does not remove the problem, it actually aggravates it The network needs to tell the sender to slow down (affects the sender window size in TCP) Actual window size = Min (receiver window size, congestion window size) The congestion window is flow control imposed by the sender The advertised window is flow control imposed by the receiver
  • 13. TCP 13 Transmission Control Protocol 7/10 •Error Control Mechanisms for detecting corrupted segments, lost segments, out-of-order segments, and duplicated segments Tools: checksum (corruption), ACK, and time-out (one time- out counter per segment) Lost segment or corrupted segment are the same situation: segment will be retransmitted after time-out (no NACK in TCP) Duplicate segment (destination discards) Out-of-order segment (destination does not acknowledge, until it receives all segments that precede it) Lost ACK (loss of an ACK is irrelevant, since ACK mechanism is cumulative)
  • 14. Reserved TCP Port Numbers Port number: Service: 0 Reserved 7 Echo 17 Quote of the day 21 FTP 23 TELNET 25 SMTP 37 Time 79 Finger 80 HTTP 119 NNTP
  • 15. It is connection oriented protocol so follows following • Provides flow and error control • receiver can immediately handle any packet it receives • receiver can never be overwhelmed with incoming packets. • Three way handshaking : connection establishment , data transfer , connection termination Transmission control protocol Process 08/31/24 15 Dr. Prasanna Singh CN Unit-4 CSBS
  • 17. Establishing a TCP Connection • The 3-way handshake • Guarantee that both sides are ready for connection • Allows both sides to agree on initial sequence numbers Receive data ACK= x+1,seq=y Site 1 Network Site 2 Send data with seqno=x Send ACK= y+1 Receive ACK Receive ACK
  • 18. •How much data should be sent by sender to the receiver •So that Receiver can process it …. How much data should be sent by sender without getting acknowledgement Data Transfer( Pushing or pulling) 08/31/24 18 Dr. Prasanna Singh CN Unit-4 CSBS
  • 19. Data Transfer at the transport layer 08/31/24 19 Dr. Prasanna Singh CN Unit-4 CSBS
  • 20. Closing a TCP Connection • Applications should close a connection when they have no more data to transmit • Connection can be closed in either one or both directions • Site 1 finishes transmitting data and waits for ACK from site 2 • Site 1 transmits a segment with the FIN bit set • Site 2 acknowledges the FIN segment • Site 2 notifies the application that no more data is coming • Data can still be transmitted from site 2 to site 1 • Site 1 will still receive and acknowledge data from site 2 • Eventually, site 2 will finish transmitting and close its connection • Both endpoints delete record of the connection
  • 21. Closing a TCP Connection (cont) Site 1 Network Site 2 Send FIN seq=x Receive FIN Send ACK x+1 Receive ACK (inform application) (app closes connection)
  • 23. TCP 23 TCP Header Fields 1/2 •Source Port and Destination Port Identify processes at ends of the connection •Control bits
  • 24. TCP 24 TCP Header Fields 2/2 •Sequence Number: position of the data in the sender’s byte stream •Acknowledgment Number: position of the byte that the source expects to receive next (valid if ACK bit set) •Header Length: header size in 32-bit units. Value ranges from [5-15] •Window: advertised window size in bytes •Urgent defines end of urgent data (or “out-of-band”) data and start of normal data Added to sequence number (valid only if URG bit is set) •Checksum: 16-bit CRC (Cyclic Redundancy Check) over header and data •Options: up to 40 bytes of options