Some slides courtesy David Wetherall. Communications Software. Lecture 4: Connections and Flow Control. CSE 123b. Spring 2003.

Similar documents
Last Class. CSE 123b Communications Software. Today. Naming Processes/Services. Transmission Control Protocol (TCP) Picking Port Numbers.

Connections. Topics. Focus. Presentation Session. Application. Data Link. Transport. Physical. Network

CSE/EE 461 Lecture 14. Connections. Last Time. This Time. We began on the Transport layer. Focus How do we send information reliably?

CSE 461 Connections. David Wetherall

CSE 461 Module 11. Connections

CSEP 561 Connections. David Wetherall

CSEP 561 Connections. David Wetherall

CSE/EE 461 Lecture 12 TCP. A brief Internet history...

CSE 461 The Transport Layer

TCP Overview. Connection-oriented Byte-stream

Application Service Models

CSCI-1680 Transport Layer I Rodrigo Fonseca

CSCI-1680 Transport Layer I Rodrigo Fonseca

Internet transport protocols

Chapter 5 End-to-End Protocols

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 5 - Part 2

Reliable Byte-Stream (TCP)

Internet Protocols Fall Outline

Transport Layer (TCP/UDP)

End-to-End Protocols. End-to-End Protocols

Lecture 22: TCP & NAT. CSE 123: Computer Networks Alex C. Snoeren

Introduc)on to Computer Networks

CS 43: Computer Networks. 18: Transmission Control Protocol October 12-29, 2018

SWITCHING, FORWARDING, AND ROUTING

User Datagram Protocol

CSE/EE 461 Lecture 13 Connections and Fragmentation. TCP Connection Management

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

ECE 650 Systems Programming & Engineering. Spring 2018

Problem. Chapter Outline. Chapter Goal. End-to-end Protocols. End-to-end Protocols. Chapter 5. End-to-End Protocols

EE 122: Transport Protocols: UDP and TCP

Introduc)on to Computer Networks

Operating Systems and Networks. Network Lecture 8: Transport Layer. Adrian Perrig Network Security Group ETH Zürich

Operating Systems and Networks. Network Lecture 8: Transport Layer. Where we are in the Course. Recall. Transport Layer Services.

End-to-End Protocols: UDP and TCP. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

COMPUTER NETWORKS CS CS 55201

COMPUTER NETWORKS CS CS 55201

Fundamentals of Computer Networks ECE 478/578. Transport Layer. End- to- End Protocols 4/16/13. Spring Application. Application.

TCP & UDP. Transport Layer. Transport. Network. Functions. End-to-end Reliable Byte Stream. Unreliable End-to-end. C.K. Kim

TSIN02 - Internetworking

CS 455: INTRODUCTION TO DISTRIBUTED SYSTEMS [NETWORKING] Frequently asked questions from the previous class surveys

Transport Layer Marcos Vieira

UNIT V. Computer Networks [10MCA32] 1

TCP Adaptive Retransmission Algorithm - Original TCP. TCP Adaptive Retransmission Algorithm Jacobson

UNIT IV TRANSPORT LAYER

EEC-682/782 Computer Networks I

Overview. Internetworking and Reliable Transmission. CSE 561 Lecture 3, Spring David Wetherall. Internetworking. Reliable Transmission

TSIN02 - Internetworking

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

EE 122: Transport Protocols. Kevin Lai October 16, 2002

Outline Computer Networking. Functionality Split. Transport Protocols

CSE/EE 461. Sliding Windows and ARQ. Last Time. This Time. We finished up the Network layer Internetworks (IP) Routing (DV/RIP, LS/OSPF)

CS 356: Computer Network Architectures. Lecture 17: End-to-end Protocols and Lab 3 Chapter 5.1, 5.2. Xiaowei Yang

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

TCP. TCP: Overview. TCP Segment Structure. Maximum Segment Size (MSS) Computer Networks 10/19/2009. CSC 257/457 - Fall

TSIN02 - Internetworking

Page 1. Goals for Today" Placing Network Functionality" Basic Observation" CS162 Operating Systems and Systems Programming Lecture 15

TSIN02 - Internetworking

05 Transmission Control Protocol (TCP)

Lecture 3: The Transport Layer: UDP and TCP

6. The Transport Layer and protocols

TCP Review. Carey Williamson Department of Computer Science University of Calgary Winter 2018

TCP: Transmission Control Protocol UDP: User Datagram Protocol TCP - 1

Lenuta Alboaie Computer Networks

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

OSI Transport Layer. objectives

CS457 Transport Protocols. CS 457 Fall 2014

Transport Protocols. Raj Jain. Washington University in St. Louis

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

Computer Network Programming. The Transport Layer. Dr. Sam Hsu Computer Science & Engineering Florida Atlantic University

Transport Layer: Outline

Transport Protocols. CSCI 363 Computer Networks Department of Computer Science

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

Internet and Intranet Protocols and Applications

CSE 461 Module 10. Introduction to the Transport Layer

Networking Technologies and Applications

Transport: How Applications Communicate

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

Computer Networks. Transmission Control Protocol. Jianping Pan Spring /3/17 CSC361 1

TCP: Transmission Control Protocol RFC 793,1122,1223. Prof. Lin Weiguo Copyleft 2009~2017, School of Computing, CUC

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

TCP : Fundamentals of Computer Networks Bill Nace

xkcd.com End To End Protocols End to End Protocols This section is about Process to Process communications.

Computer and Network Security

CS4700/CS5700 Fundamentals of Computer Networks

UDP, TCP, IP multicast

Functionality Split Computer Networking. Transport Protocols. Overview. Multiplexing & Demultiplexing

TRANSMISSION CONTROL PROTOCOL. ETI 2506 TELECOMMUNICATION SYSTEMS Monday, 7 November 2016

TCP Basics : Computer Networking. Overview. What s Different From Link Layers? Introduction to TCP. TCP reliability Assigned reading

QUIZ: Longest Matching Prefix

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Transport Layer (TCP/UDP)

Information Network 1 TCP 1/2

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

ECE 435 Network Engineering Lecture 9

Chapter 3 Transport Layer

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

ITS323: Introduction to Data Communications

Transcription:

CSE 123b Communications Software Spring 2003 Lecture 4: Connections and Flow Control Stefan Savage Some slides courtesy David Wetherall

Administrativa Computer accounts have been setup You can use the following facilities CSE uape lab (basement of CSE) Engineering Building 2, room 313 EBU1-3327 (served by ieng9) EBU1-3329 (served by ieng9) Or login from home (ieng9.ucsd.edu) If you don t have an active OCE account you will need to get one (see me after class) We will give the first programming assignment next week, so go make sure you account works now! April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 2

Last Class We talked about how to implement a reliable channel in the transport layer Approaches ARQ (Automatic Repeat request), Sliding window» Good RTT estimates» Packet sequencing as an indicator of loss (Fast Retransmit) FEC (Forward Error Correction)» Redundant data encoding» Appropriate for asymmetric channels, multicast, or high delay high loss channels April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 3

Today Finish basic transport protocol issues in context of User Datagram Protocol (UDP) Transmission Control Protocol (TCP) Connection-oriented vs connection-less transport Naming Connection setup Connection teardown Flow control How do we manage buffering at the endpoints? April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 4

Naming Processes/Services Process here is an abstract term for your Web browser (HTTP), Email servers (SMTP), hostname translation (DNS), RealAudio player (RTSP/RDT), etc. How do we identify for remote communication? Process id or memory address are OS-specific and transient So TCP and UDP use Ports 16-bit integers representing mailboxes that processes rent Identify process uniquely as (IP address, protocol, port) April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 5

Picking Port Numbers We still have the problem of allocating port numbers What port should a Web server use on host X? To what port should you send to contact that Web server? Servers typically bind to well-known port numbers e.g., HTTP 80, SMTP 25, DNS 53, look in /etc/services Ports below 1024 traditionally reserved for well-known services Clients use OS-assigned temporary (ephemeral) ports Above 1024, recycled by OS when client finished April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 6

Transmission Control Protocol (TCP) Reliable bi-directional bytestream between processes Message boundaries are not preserved Connection-oriented Conversation between two endpoints with beginning and end Flow control (later) Prevents sender from over-running receiver buffers Congestion control (next class) Prevents sender from over-running network buffers April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 7

TCP Delivery Application process Application process Write bytes Read bytes TCP Send buffer TCP Receive buffer Transmit segments Segment Segment Segment April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 8

TCP Header Format Ports plus IP addresses identify a connection 0 4 10 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 9

TCP Header Format Sequence, Ack numbers used for the sliding window How big a window? Flow control/congestion control determine 0 4 10 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 10

TCP Header Format Flags may be URG, ACK, PSH, RST, SYN, FIN 0 4 10 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 11

Connection Establishment Both sender and receiver must be ready before we start to transfer the data Sender and receiver need to agree on a set of parameters Most important: sequence number space in each direction Lots of other parameters: e.g., the Maximum Segment Size This is signaling It sets up state at the endpoints Similar to dialing in the telephone network Handshake protocols: setup state between two oblivious endpoints April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 12

Two-way way handshake? Active participant (client) Passive participant (server) SYN, SequenceNum = x SYN, SequenceNum = y, +data What s wrong here? April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 13

Two-way way handshake? Active participant (client) Passive participant (server) Old SYN, SequenceNum = x Delayed old SYN, New SYN, SequenceNum = q Rejected, SYN, SequenceNum = y +data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 14

Three-Way Handshake Opens both directions for transfer Active participant (client) Passive participant (server) SYN, SequenceNum = x SYN + ACK, SequenceNum = y, Acknowledgment = x + 1 ACK, Acknowledgment = y + 1 +data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 15

Some Comments We could abbreviate this setup, but it was chosen to be robust, especially against delayed duplicates Three-way handshake from Tomlinson 1975 Choice of changing initial sequence numbers (ISNs) minimizes the chance of hosts that crash getting confused by a previous incarnation of a connection How to choose ISNs? Maximize period between reuse Minimize ability to guess (why?) April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 16

TCP State Transitions CLOSED Active open/syn Passive open Close Close LISTEN SYN/SYN + ACK Send/ SYN SYN/SYN + ACK SYN_RCVD SYN_SENT ACK SYN + ACK/ACK Close /FIN ESTABLISHED Close /FIN FIN_WAIT_1 FIN/ACK ACK FIN/ACK CLOSE_WAIT Close /FIN FIN_WAIT_2 CLOSING LAST_ACK ACK Timeout after two ACK segment lifetimes FIN/ACK TIME_WAIT CLOSED April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 17

Again, with States Active participant (client) SYN_SENT Passive participant (server) LISTEN SYN, SequenceNum = x SYN + ACK, SequenceNum = y, Acknowledgment = x + 1 ESTABLISHED SYN_RCVD ACK, Acknowledgment = y + 1 +data ESTABLISHED April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 18

Connection Teardown Orderly release by sender and receiver when done Delivers all pending data and hangs up Cleans up state in sender and receiver TCP provides a symmetric close both sides shutdown independently April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 19

TCP Connection Teardown Web server Web browser FIN FIN_WAIT_1 CLOSE_WAIT LAST_ACK CLOSED ACK FIN ACK FIN_WAIT_2 TIME_WAIT CLOSED April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 20

The TIME_WAIT State We wait 2MSL (two times the maximum segment lifetime of 60 seconds) before completing the close Why? ACK might have been lost and so FIN will be resent Could interfere with a subsequent connection Real life: Abortive close Some systems don t wait for 2*MSL, simply send Reset packet (RST) Why? Frees up resources immediately April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 21

Flow Control Sender must transmit data no faster than it can be consumed by the receiver Receiver might be a slow machine App might consume data slowly Implement by adjusting the size of the sliding window used at the sender based on receiver feedback about available buffer space This is the purpose of the Advertised Window field April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 22

TCP Header Format Advertised window is used for flow control 0 4 10 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 23

Sender and Receiver Buffering Sending application Receiving application TCP TCP LastByteWritten LastByteRead LastByteAcked LastByteSent NextByteExpected LastByteRcvd = available buffer = buffer in use April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 24

Example Exchange of Packets SEQ=1 ACK=2; WIN=3 SEQ=2 ACK=3; WIN=2 SEQ=3 SEQ=4 ACK=4; WIN=1 Stall due to flow control here T=1 T=2 T=3 T=4 T=5 Receiver has buffer of size 4 and application doesn t read ACK=5; WIN=0 T=6 April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 25

Example Buffer at Sender T=1 1 2 3 4 5 6 7 8 9 T=2 T=3 T=4 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 =acked =sent =advertised T=5 1 2 3 4 5 6 7 8 9 T=6 1 2 3 4 5 6 7 8 9 April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 26

Lots of icky details Window probes Silly Window Syndrome Nagel s algorithm PAWS Etc Steven s books TCP/IP Illustrated (vol 1,2) is a great source of information on this April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 27

Example Icky Detail: Advertised Window Deadlock If the receiving process does not empty the buffer (e.g., not scheduled), then the sender fills up the receiver s buffer Advertised Window is 0 Effective Window goes to 0 when all data is ACKed Problem: When can the sender start sending again? No timeouts because all data is ACKed No packets from receiver with a new Advertised Window because receiver isn t running Solution: Ping with a segment of 1 byte of data Eventually receiver responds with a new Advert. Window April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 28

Misc TCP Header fields Header length allows for variable length TCP header with options for extensions such as timestamps, selective acknowledgements, etc. Checksum protects TCP header and data Urgent pointer/data not used in practice 0 4 10 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 29

TCP applications HTTP/WWW FTP SMTP, POP, IMAP (E-mail) Why is TCP well suited to these applications? April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 30

User Datagram Protocol (UDP) Provides unreliable message delivery between processes Source port filled in by OS as message is sent Destination port identifies UDP delivery queue at endpoint Connectionless (no state about who talks to whom) 0 16 31 SrcPort DstPort Checksum Length Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 31

UDP Delivery Ports Application process Application process Application process Kernel boundary Message Queues DeMux Packets arrive April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 32

UDP Checksum UDP includes optional protection against errors Checksum intended as an end-to-end check on delivery So it covers data, UDP header, and IP pseudoheader 0 16 31 SrcPort DstPort Checksum Length Data April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 33

Applications for UDP Streaming media DNS (Domain Name Service) NTP (Network Time Protocol) Why is UDP appropriate for these? April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 34

Homework Problems from Peterson & Davies: 1.5, 1.8, 2.20, 2.22, 2.26, 4.4(a,b) Next class: Congestion Control No new reading, make sure you re caught up April 16, 2003 CSE 221 -- Lecture 5 Congestion Control 35