ECE 650 Systems Programming & Engineering. Spring 2018

Similar documents
ECE 650 Systems Programming & Engineering. Spring 2018

QUIZ: Longest Matching Prefix

EEC-682/782 Computer Networks I

TSIN02 - Internetworking

TSIN02 - Internetworking

Networking Technologies and Applications

Lecture 3: The Transport Layer: UDP and TCP

User Datagram Protocol

TSIN02 - Internetworking

TSIN02 - Internetworking

05 Transmission Control Protocol (TCP)

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

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

COMPUTER NETWORKS CS CS 55201

COMPUTER NETWORKS CS CS 55201

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

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

Internet and Intranet Protocols and Applications

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

UNIT V. Computer Networks [10MCA32] 1

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

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

ECE 435 Network Engineering Lecture 15

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Introduction to Networks and the Internet

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

ECE4110 Internetwork Programming. Introduction and Overview

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

9th Slide Set Computer Networks

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

NT1210 Introduction to Networking. Unit 10

Computer Communication Networks Midterm Review

CS4700/CS5700 Fundamentals of Computer Networks

Layer 4: UDP, TCP, and others. based on Chapter 9 of CompTIA Network+ Exam Guide, 4th ed., Mike Meyers

Transport Layer Marcos Vieira

OSI Transport Layer. objectives

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

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

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

11/24/2009. Fundamentals of Computer Networks ECE 478/578. Flow Control in TCP

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

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

CS457 Transport Protocols. CS 457 Fall 2014

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

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

Reliable Byte-Stream (TCP)

User Datagram Protocol (UDP):

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

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

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

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

What is TCP? Transport Layer Protocol

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

Transmission Control Protocol (TCP)

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

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

7. TCP 최양희서울대학교컴퓨터공학부

CSEP 561 Connections. David Wetherall

Transport Protocols. CSCI 363 Computer Networks Department of Computer Science

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

Chapter 6. (Week 12) The Transport Layer (CONTINUATION) ANDREW S. TANENBAUM COMPUTER NETWORKS FOURTH EDITION PP

CSCD 330 Network Programming

Intro to LAN/WAN. Transport Layer

6. The Transport Layer and protocols

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

Transport Protocols and TCP

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

Transport Layer: outline

CSCE 463/612 Networks and Distributed Processing Spring 2017

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

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

CSCD 330 Network Programming Winter 2015

CS Lecture 1 Review of Basic Protocols

TCP : Fundamentals of Computer Networks Bill Nace

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

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

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CNT 6885 Network Review on Transport Layer

UDP, TCP, IP multicast

CSEP 561 Connections. David Wetherall

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

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

CSE 4213: Computer Networks II

Application. Transport. Network. Link. Physical

Simulation of TCP Layer

Introduction to TCP/IP networking

Internet transport protocols

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Network Technology 1 5th - Transport Protocol. Mario Lombardo -

Unix Network Programming

Applied Networks & Security

Introduc)on to Computer Networks

Computer Networking Introduction

EE 122: Transport Protocols: UDP and TCP

The Transport Layer. Internet solutions. Nixu Oy PL 21. (Mäkelänkatu 91) Helsinki, Finland. tel fax.

Chapter 2 - Part 1. The TCP/IP Protocol: The Language of the Internet

Transcription:

ECE 650 Systems Programming & Engineering Spring 2018 Networking Transport Layer Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke)

TCP/IP Model 2

Transport Layer Problem solved: communication among processes Application-level multiplexing ( ports ) Error detection, reliability, etc. 3

Transport Layer Typical Goal: Provide reliable, cost-effective data transport between different machines, independent of the physical network Again, 2 types of service: connectionless vs. connections Why? Transport code runs entirely on endpoint machines Network layer code runs mostly on routers Thus users have no control over network layer, so if want improved quality of service, must implement in transport layer Provides standard set of API primitives to applications Independent of issues or differences in underlying networks 4

Connectionless vs. Connection Connectionless transport layer Very similar to network layer Not much additional service provided on top But less networking stack SW overheads as a result E.g. UDP Connection-oriented transport layer Provides error-free, reliable communication Can think of communication between two processes on different machines as just like UNIX pipes or fifos One process puts data in one end, other process takes it out E.g. TCP 5

Example Transport Service API Primitive Packet sent Meaning LISTEN (none) Block until some process tries to connect CONNECT CONNECTION REQ Actively attempt to establish a connection SEND DATA Send information RECEIVE (none) Block until a DATA packet arrives DISCONNECT DISCONNECT REQ This side wants to release the connection Frame header Packet header Transport header Frame trailer h h h Transport payload t 6

Recall UNIX TCP sockets Primitive SOCKET BIND LISTEN ACCEPT CONNECT SEND RECV CLOSE Meaning Create a new communication end point Attach a local address to a socket Announce willingness to accept connections; give queue size Block the caller until a connection attempt arrives Actively attempt to establish a connection Send some data over the connection Receive some data from the connection Release the connection 7

UDP Connectionless service User Datagram Protocol Essentially allows applications to send IP datagrams With just slightly more encapsulation UDP transmits segments Simply 8 byte header followed by payload 8

Ports Allows application-level multiplexing of network services Processes attach to ports to use network services Port attachment is done with BIND operation Destination port When a UDP packet arrives, its payload is handed to process attached to the destination port specified Source port Mainly used when some reply is needed Receiver can use the source port as the dest port in reply msg 9

UDP What it does NOT do Flow control Error control Retransmission on receipt of bad segment User processes must handle this For apps needing precise control over packet flow, error control, or timing, UDP is a great fit E.g. client-server situations where client sends short request and expects short reply back; client can timeout & retry easily DNS (Domain Name System): For looking up IP addr of host name Client sends host name, receives IP address response 10

TCP Connection-oriented Service Transmission Control Protocol Designed for end-to-end byte stream over unreliable network Robust against failures and changing network properties TCP transport entity e.g. Library procedure(s), user processes, or a part of the kernel Manages TCP streams and interfaces to the IP layer Accepts user data streams from processes Breaks up into pieces not larger than 64 KB Often 1460 data bytes to fit in 1 Ethernet frame w/ IP + TCP headers Sends each piece separately as IP datagram Destination machine TCP entity reconstructs original byte stream Handles retransmissions & re-ordering 11

TCP Service Model TCP service setup as follows: Two endpoint processes create endpoints called sockets Each socket has an address: IP address of host + 16-bit port API functions used to create & communicate on sockets Ports Numbers below 1024 called well-known ports Reserved for standard services, like FTP, HTTP, SMTP http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml 12

TCP Service Model (2) TCP connections are full-duplex & point-to-point Simultaneous traffic in both directions Exactly 2 endpoints (no multicast or broadcast) TCP connection is a byte stream, not message stream Receiver has no way to know what granularity bytes were sent E.g. 4 x 512 byte writes vs. 1 x 2048 byte write It can just receive some # of bytes at a time Just like UNIX files! TCP may buffer data or send it immediately PUSH flag indicates to TCP not to delay transmission TCP tries to make a latency vs. bandwidth tradeoff 13

TCP Protocol TCP sequence number underlies much of the protocol Every byte sent has its own 32-bit sequence number TCP exchanges data in segments 20-byte fixed header (w/ optional part) Followed by 0 or more data bytes TCP can merge writes into one segment or split a write up Segment size limitations: Must fit (including header) inside 65,515 byte IP payload Networks have a MTU (max transfer unit) e.g. 1500 bytes for Ethernet payload size Uses a sliding window protocol (acks + timeout + seq #) Ack indicates the next seq # the receiver expects to get May be piggy-backed with data going in the other direction 14

TCP Header Up to 65,536 20 20 = 65,495 data bytes may be included 20 for IP header and 20 for TCP header Segments with no data are legal (used for ACK and control msgs) 15

TCP Header Fields Source and destination ports Similar to what we discussed for UDP Sequence number Corresponds to bytes not packets Acknowledgement number Specifies the next byte expected by receiver Data offset (or TCP header length) # of 32-bit words contained in the TCP header Needed because length of Options field is variable 16

TCP Header Fields (2) Six 1-bit flags ACK: indicates whether acknowledgement number is valid RST: reset a connection E.g. due to host crash, or refuse a connection open attempt SYN: used to establish connections Connection requests uses SYN=1, ACK=0 Connection reply uses SYN=1, ACK=1 FIN: used to release a connection URG: set to 1 if urgent pointer is in use Points to a byte offset from current SN where there is urgent data Receiver will be interrupted so it can find urgent data and handle it PSH: indicates PUSHed data Receiver is requested to deliver this data immediately to a process i.e. do not buffer it, as may be done for efficiency 17

TCP Header Fields (3) Window For flow control in TCP variable-sized sliding window Indicates how many bytes may be sent Starting at the byte acknowledged Decouples ACKs from permission to send more data Checksum For reliability; checksum over header and data Add up all 16-bit words in one s complement Then take one s complement of sum When receiver recomputes, result should be 0 18

TCP Header Fields (4) Options field Way to add facilities not covered by regular header Most widely used option allows host to specify max TCP payload it is willing to accept (MSS: max segment size) Large segments are more efficient, but may not work for small hosts During connection setup, each side announces its max size If host does not use the option, it defaults to 536 byte payload TCP hosts required to accept 536 + 20 = 556 bytes More on window size Max window size is 64KB (2^16) Problem for high bandwidth or high delay channels On T3 line (44.736 Mbps), takes 12msec to output full 64KB If round-trip propagation delay is 50ms, sender will be idle ¾ of time Satellite connection even worse Window scale option now commonly supported Both sides shift window up to 14 bits left (up to 2^30 bytes) 19

TCP Connection Connect Listen, Accept Three-way handshake Two sides agree on respective initial sequence nums If no one is listening on port: server sends RST If server is overloaded: ignore SYN If no SYN+ACK: retry, timeout Accept returns 20

FIN bit says no more data to send Caused by close or shutdown Both sides must send FIN to close a connection Typical close TCP Connection Release I m done. good bye Close No, I didn t get all your data Sure stop talking Close I m done. Good bye Sure stop talking CLOSED CLOSED 21

Flow Control We should not send more data than the receiver can take When to send data? Sender can delay sends to get larger segments How much data to send? Data is sent in MSS-sized segments Chosen to avoid fragmentation Receiver uses window header field to tell sender how much space it has 22

TCP Flow Control Receiver: AdvertisedWindow (how much room left) = MaxRcvBuffer ((NextByteExpected-1) LastByteRead) Sender: LastByteSent LastByteAcked <= AdvertisedWindow 23

TCP Flow Control Advertised window can fall to 0 Sender eventually stops sending, blocks application 24

Nagle s algorithm When to Transmit? Goal: reduce the overhead of small packets If available data and window >= MSS Send a MSS segment else If there is unacked data in flight buffer the new data until ACK arrives else send all the new data now Receiver should avoid advertising a window <= MSS after advertising a window of 0 25

Delayed Acknowledgements Goal: Piggy-back ACKs on data Delay ACK for 200ms in case application sends data If more data received, immediately ACK second segment Note: never delay duplicate ACKs (if missing a segment) Warning: can interact very badly with Nagle Temporary deadlock Can disable Nagle with TCP_NODELAY Application can also avoid many small writes 26