Docsity

TCP - Networking - Lecture Slides, Slides of Computer Networks

Partial preview of the text

Download TCP - Networking - Lecture Slides and more Slides Computer Networks in PDF only on Docsity!

TCP

TCP Header

2

Source port Destination port

Sequence number

Acknowledgment

HdrLen (^) Flags Advertised window 0

Checksum Urgent pointer

Options (variable)

Data

Used to mux

and demux

What does TCP do?

Many of our previous ideas, but some key differences

  • Checksum

TCP Header

5

Source port Destination port

Sequence number

Acknowledgment

HdrLen (^) Flags Advertised window 0

Checksum Urgent pointer

Options (variable)

Data

Computed

over header

and data

TCP: Segments and

Sequence Numbers

TCP “Stream of Bytes” Service…

Application @ Host A

Application @ Host B

TCP Segment

  • IP packet
    • No bigger than Maximum Transmission Unit (MTU)
    • E.g., up to 1500 bytes with Ethernet
  • TCP packet
    • IP packet with a TCP header and data inside
    • TCP header  20 bytes long
  • TCP segment
    • No more than Maximum Segment Size (MSS) bytes
    • E.g., up to 1460 consecutive bytes from the stream
    • MSS = MTU – (IP header) – (TCP header)

IP Hdr

IP Data

TCP Data (segment) TCP Hdr

Sequence Numbers

Host A

ISN (initial sequence number)

Sequence number

= 1

st

byte in segment =

ISN + k

k bytes

TCP Header

Source port Destination port

Sequence number

Acknowledgment

HdrLen (^) Flags Advertised window 0

Checksum Urgent pointer

Options (variable)

Data

Starting byte

offset of data

carried in this

segment

What does TCP do?

Most of our previous tricks, but a few differences

  • Checksum
  • Sequence numbers are byte offsets
  • Receiver sends cumulative acknowledgements (like GBN)

Normal Pattern

  • Sender: seqno=X, length=B
  • Receiver: ACK=X+B
  • Sender: seqno=X+B, length=B
  • Receiver: ACK=X+2B
  • Sender: seqno=X+2B, length=B
  • Seqno of next packet is same as last ACK field

TCP Header

17

Source port Destination port

Sequence number

Acknowledgment

HdrLen (^) Flags Advertised window 0

Checksum Urgent pointer

Options (variable)

Data

Acknowledgment

gives seqno just

beyond highest

seqno received in

order

( “ What Byte

is Next ” )

Loss with cumulative ACKs

  • Sender sends packets with 100B and seqnos.:
    • 100, 200, 300, 400, 500, 600, 700, 800, 900, …
  • Assume the fifth packet (seqno 500) is lost, but no others
  • Stream of ACKs will be:
    • 200, 300, 400, 500, 500, 500, 500,…

What does TCP do?

Most of our previous tricks, but a few differences

  • Checksum
  • Sequence numbers are byte offsets
  • Receiver sends cumulative acknowledgements (like GBN)
  • Receivers may not drop out-of-sequence packets (like SR)
  • Introduces fast retransmit: optimization that uses duplicate

ACKs to trigger early retransmission