25
The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, e-mail, WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery Service (IP) Unreliable Transport Service (UDP)

The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

  • Upload
    vuhanh

  • View
    241

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

The Transmission Control Protocol (TCP)

Application Services

(Telnet, FTP, e-mail, WWW)

Reliable Stream

Transport (TCP)

Connectionless Packet Delivery Service

(IP)

Unreliable Transport

Service (UDP)

Page 2: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

2

Goals for Today’s Lecture • Principles underlying transport-layer services – (De)multiplexing – Detecting corruption – Reliable delivery – Flow control

• Transport-layer protocols in the Internet – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP)

Page 3: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

3

Role of Transport Layer •  Application layer – Communication for specific applications – E.g., HyperText Transfer Protocol (HTTP), File Transfer

Protocol (FTP), Network News Transfer Protocol (NNTP) •  Transport layer – Communication between processes (e.g., socket) – Relies on network layer and serves the application layer – E.g., TCP and UDP

Network layer – Logical communication between nodes – Hides details of the link technology – E.g., IP

Page 4: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

4

Transport Protocols •  Provide logical communication

between application processes running on different hosts

•  Run on end hosts

– Sender: breaks application messages into segments, and passes to network layer – Receiver: reassembles

segments into messages, passes to application layer

•  Multiple transport protocol available to applications

application transport network data link physical

application transport network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

network data link physical

Page 5: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

5

Internet Transport Protocols •  Datagram messaging service (UDP) – No-frills extension of “best-effort” IP

•  Reliable, in-order delivery (TCP) – Connection set-up – Discarding of corrupted packets – Retransmission of lost packets – Flow control – Congestion control (next lecture)

•  Other services not available – Delay guarantees – Bandwidth guarantees

Page 6: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

6

TCP Support for Reliable Delivery •  Checksum –  Used to detect corrupted data at the receiver –  …leading the receiver to drop the packet

•  Sequence numbers –  Used to detect missing data –  ... and for putting the data back in order

•  Retransmission –  Sender retransmits lost or corrupted data –  Timeout based on estimates of round-trip time –  Fast retransmit algorithm for rapid retransmission

Page 7: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Initiating Stream Transfers (cont)

•  An endpoint for a TCP connection is defined by a (host, port) pair –  Host = the IP address of for a host –  Port = a TCP port on that host

•  A TCP connection is defined by a pair of endpoints: –  Port 1037 on www.whitehouse.gov and port 76 on

viper.cs.virginia.edu: •  (198.137.240.91, 1037) and (128.143.137.17, 76)

Page 8: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

TCP Data Stream Format

•  Data from application programs is a sequence of octets (with no type associated)

•  TCP divides data into segments for transmission •  Usually, each segment travels across the internet

in a single IP datagram

Page 9: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Providing Reliability with Acknowledgments and Retransmissions

Sender Network Receiver

Receive ACK 2

Send packet 1

Send ACK 1 Receive packet 1

Send packet 2

Receive ACK 1

Receive packet 2

Send ACK 2

Page 10: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Packet Loss

Sender Network Receiver Send packet 1

Send packet 1

Receive ACK 1

Receive packet 1

Send ACK 1

(Timeout)

Page 11: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

ACK Loss

Sender Network Receiver Send packet 1

Send packet 1

Receive ACK 1

(Timeout)

Send ACK 1 Receive packet 1

Receive packet 1

Send ACK 1 (Discard)

Page 12: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

ACK Delayed

Sender Network Receiver Send packet 1

Receive ACK 1

Receive ACK 1

(Timeout) Send packet 1

(Discard)

Send ACK 1

Receive packet 1

Receive packet 1

Send ACK 1 (Discard)

Page 13: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

A Problem

A simple positive acknowledgment

protocol wastes a substantial amount of network bandwidth because it must delay sending a new packet until it receives an acknowledgment for the previous packet.

Page 14: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

A Solution

Sender Network Receiver

1

2

3 ACK1

ACK2

ACK3

Page 15: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Sliding Windows

1 2 3 4 5 6 7 8 9 10

All packets inside the window can be transmitted

When an acknowledgment for packet 1 is received the window slides to the right and allows the transmission of packet 9:

1 2 3 4 5 6 7 8 9 10

window

Page 16: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Sliding Windows (cont)

•  Receiver must keep a sliding window as well: •  After packet 1 is received and acknowledged:

1 2 3 4 5 6 7 8 9 10

window

1 2 3 4 5 6 7 8 9 10

Page 17: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Sliding Windows (cont)

•  Conceptually partitions the packets into three

classes: –  Transmitted, received, and acknowledged packets

(outside and left of sliding window) –  Packets being transmitted (inside the window) –  Packets waiting to be transmitted (outside and right of

sliding window)

1 2 3 4 5 6 7 8 9 10

Page 18: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer

Ideal Sliding Window Performance

Sender Network Receiver

Page 19: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 20: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 21: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 22: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 23: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 24: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer
Page 25: The Transmission Control Protocol (TCP)web.karabuk.edu.tr/bilalkaya/file/tcp.pdf · – User Datagram Protocol (UDP) – Transmission Control Protocol (TCP) 3 Role of Transport Layer