Chapter 3 Transport Layer A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) in substantially unaltered form, that you mention their source (after all, we’d like people to use our book!) If you post any slides in substantially unaltered form on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Computer Networking: A Top Down Approach 4th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. Thanks and enjoy! JFK/KWR All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights Reserved 1 Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 2 TCP Connection Establishment Three-way handshake Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYN+ACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYN+ACK, replies with ACK segment, which may contain data aida.poly.edu mng.poly.edu SYN (Seq No = x) ckNo = x + 1 ) A , y = o N q e SYN (S (SeqNo = x +1, AckNo =y+1) 3 TCP segment structure 32 bits URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) source port # dest port # sequence number acknowledgement number head not UA P R S F len used checksum Receive window Urg data pnter Options (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept application data (variable length) 4 TCP Connection Termination Step 1: client end system sends TCP FIN control segment to server client server close Step 2: server receives FIN, replies with ACK. When server is done sending all data, it closes connection by sending FIN. replies with ACK. Enters “timed wait” - will respond with ACK to received FINs Step 4: server, receives ACK. timed wait Step 3: client receives FIN, close closed Connection closed. 5 TCP Connection Management (cont) aida.poly.edu mng.poly.edu SYN (Seq No = x) SYN (SeqNo = y, AckNo = x (SeqNo = x+ 1, AckNo = TCP server lifecycle +1) y+1) FIN SYN SYN + ACK ACK client close server TCP client lifecycle timed wait close closed 6 TCP state-transition diagram CLOSED Active open/SYN Passive open Close Close LISTEN SYN_RCVD SYN/SYN + ACK Send/SYN SYN/SYN + ACK ACK Close/FIN SYN_SENT SYN + ACK/ACK ESTABLISHED Close/FIN FIN/ACK FIN_WAIT_1 CLOSE_WAIT FIN/ACK ACK Close/FIN FIN_WAIT_2 CLOSING FIN/ACK ACK Timeout after two segment lifetimes TIME_WAIT LAST_ACK ACK CLOSED 7 Chapter 3 outline 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles of congestion control 3.7 TCP congestion control 8 Principles of Congestion Control Congestion: informally: “too many sources sending too much data too fast for network to handle” the load on the network is more than its capacity different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) a top-10 problem! 9 Network Performance 9/13/05 10 Approaches towards congestion control Two broad approaches towards congestion control: End-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion explicit rate sender should send at 11 Network-Assisted Congestion Control 12 TCP Congestion Control Approach Limit the rate at which sender sends data as a function of perceived congestion in the network Issues How does it perceive that there is congestion in the network? What algorithm does it use to change the sending rate as a function of the perceived level of congestion? 13