NWEN 243 Networked Applications Lecture 13: Layer 4 – Transport NWEN 243 © , Kris Bubendorfer.

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

Intermediate TCP/IP TCP Operation.
Chapter 7 Intro to Routing & Switching.  Upon completion of this chapter, you should be able to:  Explain the need for the transport layer.  Identify.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer 3-1 Transport services and protocols  provide logical communication between app processes running on different hosts  transport protocols.
Copyright 1999, S.D. Personick. All Rights Reserved. Telecommunications Networking II Lecture 32 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
Chapter 3 outline 3.1 transport-layer services
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
2: Application Layer 1 1DT066 Distributed Information System Chapter 3 Transport Layer.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
1 Computer Networks Transport Layer Protocols. 2 Application-layer Protocols Application-layer protocols –one “piece” of an app –define messages exchanged.
1 Reliable Data Transfer. 2 r Problem: Reliability  Want an abstraction of a reliable link even though packets can be corrupted or get lost r Solution:
Process-to-Process Delivery:
The Transport Layer.
Review: –What is AS? –What is the routing algorithm in BGP? –How does it work? –Where is “policy” reflected in BGP (policy based routing)? –Give examples.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
Sockets process sends/receives messages to/from its socket
Copyright 2002, S.D. Personick. All Rights Reserved.1 Telecommunications Networking II Topic 20 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery.
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
1 End-user Protocols, Services and QoS. 2 Layering: logical communication application transport network link physical application transport network link.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: Peer-to-Peer Protocols ARQ Protocols and Reliable Data Transfer Flow Control.
Transport Layer Goals: Overview:
Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable data transfer.
Transport Layer 3-1 Internet Transport Layer Lecture 8 Dr. Najla Al-Nabhan.
Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Ch 3. Transport Layer Myungchul Kim
Application Layer Functionality and Protocols Abdul Hadi Alaidi
Introduction to Networks
The Transport Layer Implementation Services Functions Protocols
Transport Layer Slides are originally from instructor: Carey Williamson at University of Calgary Very minor modification are made Notes derived from “Computer.
Chapter 3 Transport Layer
Chapter 3 outline 3.1 Transport-layer services
Performance of rdt3.0 rdt3.0 works, but performance stinks
Process-to-Process Delivery, TCP and UDP protocols
06- Transport Layer Transport Layer.
PART 5 Transport Layer Computer Networks.
TCP Transport layer Er. Vikram Dhiman LPU.
CS 1652 Jack Lange University of Pittsburgh
Introduction to Networks
Introduction of Transport Protocols
Chapter 2 Introduction Application Requirements VS. Transport Services
Transport Layer Our goals:
Process-to-Process Delivery:
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Transport Layer Our goals:
Dr. John P. Abraham Professor UTPA
EEC-484/584 Computer Networks
Dr. John P. Abraham Professor UTPA
CSCD 330 Network Programming
Chapter 5 Transport Layer Introduction
The Transport Layer De/Multiplexing, Reliability
Getting Connected (Chapter 2 Part 3)
Transport Protocols: TCP Segments, Flow control and Connection Setup
Chapter 5 Transport Layer Introduction
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Computer Networks Protocols
Chapter 3 Transport Layer
Transport Layer Our goals:
Presentation transcript:

NWEN 243 Networked Applications Lecture 13: Layer 4 – Transport NWEN 243 © , Kris Bubendorfer

Data loss some apps (e.g., audio) can tolerate some loss other apps (e.g., file transfer, telnet) require 100% reliable data transfer Timing some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” Bandwidth some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective” other apps (“elastic apps”) make use of whatever bandwidth they get Why 2 Transport protocols? 2

Application file transfer Web documents real-time audio/video stored audio/video interactive games financial apps Data loss no loss loss-tolerant no loss Bandwidth elastic audio: 5Kb-1Mb video:10Kb-5Mb same as above few Kbps up elastic Time Sensitive no yes, 100’s msec yes, few secs yes, 100’s msec yes and no Common Application Protocols 3

Internet Applications: Their Protocols and Transport Protocols Application remote terminal access Web file transfer streaming multimedia remote file server Internet telephony Application layer protocol smtp [RFC 821] telnet [RFC 854] http [RFC 2068] ftp [RFC 959] proprietary (e.g. RealNetworks) NFS proprietary (e.g., Vocaltec) Underlying transport protocol TCP TCP or UDP typically UDP 4

Recall… TCP Socket Structure Client process Client process Server process Server process “public” socket “connection” socket client socket 3-way handshake stream data NWEN 243 © , Kris Bubendorfer

Socket programming with TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client’s contact Client contacts server by: creating client-local TCP socket specifying IP address, port number of server process When client creates socket: client TCP establishes connection to server TCP When contacted by client, server TCP creates new socket for server process to communicate with client ◦ allows server to talk with multiple clients TCP provides reliable, in-order transfer of bytes (a “pipe”) between client and server Application viewpoint NWEN 243 © , Kris Bubendorfer

TCP Steps Server (on hostId) Create public socket with port = x Wait for connection create connection socket Read request from connection socket Write reply to connection socket Client Create socket Connect to hostId, port x Send request on client socket Read reply from client socket Close client socket NWEN 243 © , Kris Bubendorfer

Recall… Sockets and Ports IP (network layer) receives all datagrams for host IP delivers to appropriate transport layer (protocol) Transport protocol delivers to socket (application) IP application

TCP Ports and Sockets - Detail Server listens on a socket for a connection Connect request causes new socket on same port Server uses new thread to service connection TCP listener thread server socket port socket worker

Packet Data Units (PDUs) Packet-switched data networks Different name at each layer ◦ Layer 2 (Data Link) = frame ◦ Layer 3 (Network) = packet ◦ Layer 4 (Transport)  TCP = segment (data is broken up into multiple segments)  UDP = datagram (data must fit within maximum datagram size of 1024 bytes) NWEN 243 © , Kris Bubendorfer

The Role of Headers Each PDU is header + data Network header addresses machines ◦ Denotes protocol (TCP or UDP) Transport header addresses ports (sockets) transport header destination port other header data source port source host destination host protocol network header

Protocol layering and data Each layer takes data (service data unit or SDU) from above adds header information to create new data unit (PDU) passes new data unit to layer below Allows protocol layers to coordinate PDU = SDU + header (SDU is encapsulated) application transport network link physical application transport network link physical source destination M M M M H t H t H n H t H n H l M M M M H t H t H n H t H n H l message segment/ datagram packet frame NWEN 243 © , Kris Bubendorfer

Back to Ports Port numbers 0->1023 are well known port numbers, and are restricted. ◦ 25 SMTP ◦ 80 WWW ◦ etc Why does a transport header have both source and destination port numbers? Surely the destination port number alone is sufficient to identify the recipient? We saw how TCP creates multiple worker sockets per port ◦ we need this extra info to tell them apart ◦ so we can send packets to the correct thread. Client process Client process Server process Server process “public” socket “connection” socket client socket 3-way handshake stream data NWEN 243 © , Kris Bubendorfer

Simple Example Client is assigned some random unused port x by its host. The SMTP server runs on well known port 25. Reply is to destination port x, with src port 25 Client Server source port: x dest. port: 25 source port:25 dest. port: x port used: smtp © , Kris Bubendorfer

What About Two Clients? Web client host A Web server B Source IP: C Dest IP: B source port: x dest. port: 80 Source IP: C Dest IP: B source port: y dest. port: 80 port use: Web server Source IP: A Dest IP: B source port: x dest. port: 80 Web client host C Need more information to, ensure that the port is Demultiplexed correctly. NWEN 243 © , Kris Bubendorfer

Delivery Without Guarantees Remember, IP Datagrams may be: ◦ Duplicated, ◦ Delivered out of order, ◦ Lost/Discarded ◦ Corrupted By the network layer. The TCP protocol will need to resolve these, while the UDP protocol ignores them. NWEN 243 © , Kris Bubendorfer

How? Duplication: ◦ Store and forward (routers and switches) Out of Order Delivery ◦ Subsequent packets take different routes Lost ◦ Router input queue is full, drop packets Corrupted ◦ Interference on the physical media ◦ DLL layer can check and resolve this. NWEN 243 © , Kris Bubendorfer

What can we do? The DLL can check packets for corruption (CRC), but How do we police the routers, with the changes in the routes dropping packets, and so on? We need to ensure the delivery from machine to machine is reliable This is only done in the end machines. NWEN 243 © , Kris Bubendorfer

Simple Approach Send segment and starts a timer. Receiver receives segment. Receiver sends an ACK (acknowledgement). Either: ◦ ACK received, sender can send next segment. ◦ Timer goes off, assume segment lost so resends. This is called Stop-and-Wait. NWEN 243 © , Kris Bubendorfer

Stop And Wait Sender transmits a data packet ◦ Stops and waits for an ACK from receiver ◦ Alternating (0 or 1) sequence number Sequence number used to: ◦ Identify lost packet ◦ Discard redundant packet A Timer is used to recover from a: ◦ lost packet ◦ lost ACK NWEN 243 © , Kris Bubendorfer

SenderReceiver No loss: send pkt0 rcv pkt0 send ACK0 rcv ACK0 send pkt1 rcv pkt1 send ACK1 rcv ACK1 send pkt0 rcv pkt0 send ACK0 rcv ACK0 send pkt1 SenderReceiver Lost packet: send pkt0 X (lost) tImeout resend pkt1 rcv pkt1 send ACK1 rcv ACK1 send pkt0 rcv pkt0 send ACK0 Stop And Wait NWEN 243 © , Kris Bubendorfer

SenderReceiver Lost ACK: send pkt0 rcv pkt0 send ACK0 rcv ACK0 send pkt1 rcv pkt1 send ACK1 rcv pkt0 send ACK0 rcv ACK0 send pkt1 SenderReceiver Premature timeout: send pkt0 tImeout resend pkt1 rcv pkt1 drop duplicate rcv pkt0 send ACK0 (lost) X tImeout resend pkt1 rcv pkt1 send ACK1 rcv ACK1 send pkt0 rcv pkt1 send ACK1 rcv ACK1 send pkt0 Stop And Wait NWEN 243 © , Kris Bubendorfer

Stop and wait is a terribly inefficient approach (wasting bandwidth especially when probability of loss is low), we can do better. example: 1 Gbps link, 15 ms e-e prop. delay, 1KB segment: T transmit = 8kb/seg 10 9 b/sec = 8 microsec Utilization = U = = 8 microsec msec fraction of time sender busy sending = KB seg every 30 msec -> 33kB/sec thruput over 1 Gbps link network protocol limits use of physical resources! Stop And Wait NWEN 243 © , Kris Bubendorfer

Stop and Wait Performance Transmit 1250B at 10Mbps = 1 msec. Travel 600km in 3 msec Round trip ≈ msec Network performance <10% NWEN 243 © , Kris Bubendorfer

Pipelining Acknowldegement arrives every msec Segment arrives every msec Network performance ≈100% NWEN 243 © , Kris Bubendorfer

Pipelining: sender allows multiple, “in-flight ”, yet-to-be- acknowledged segments. Two generic forms of pipelined protocols: go-Back-N, selective repeat Pipelined Protocols NWEN 243 © , Kris Bubendorfer

How do we manage all these Segments Inflight? We can use a software construct called a sliding window. ◦ We have a fixed size window (i.e. n segments)  This means we can have up to n segments on the ‘wire’.  When we successfully send a segment (i.e. its been ack’d by the receiver), we can move the window on by 1.  range of sequence numbers must be increased, need more than {0,1}.  We need buffering at sender and/or receiver … Ack’d SegmentsunAck’d SegmentsForbidden sequence numbers available seq numbers NWEN 243 © , Kris Bubendorfer

Protocols The important features of a sliding window protocol are: ◦ Sequence number assignment ◦ The resend protocol ◦ Window management We’re going to look at GoBackN (two variations) followed by Selective repeat. VIP: The sender and receiver views of the windows may differ at any time. NWEN 243 © , Kris Bubendorfer

Go Back N Very simple receiver, only accepts segments that arrive in-order and discards others. Send each segment in window in turn, window moves on when first segment in window is acknowledged. Each segment has a timer, started when it is sent. Timeout on first segment, then all UNACKNOWLEDGED segments resent Because the receiver has discarded segments received out of order, it won’t see them twice. ◦ Packets 7, 8 and 9, see first point window (size = 8) ACK’d sent not ACK’d available Not available window (size = 8) 6 timer expires!! © , Kris Bubendorfer

9876 Go Back N (Cumulative ACK) Should a later segment be ACK’d, consider all prior segments in the window to also be ACKed, so in other words: ◦ ACK is cumulative, so an ACK for a later sequence number effectively ACKs all preceding segments. Lost ACK(6) and ACK(7) Get ACK(8) window (size = 8) ack’ed sent not ack’ed available Not available window (size = 8) 1516 ACK(8) © , Kris Bubendorfer

Go Back N in action SenderReceiver send pkt0 send pkt1 rcv pkt0 send ACK0 rcv pkt1 send ACK1 send pkt2 Lost! send pkt3 rcv ACK0 send pkt4 rcv ACK1 send pkt5 rcv pkt3, discard send ACK1 rcv pkt4, discard send ACK1 rcv pkt5, discard send ACK1 pkt2 timeout send pkt2 send pkt3 send pkt4 send pkt5 rcv pkt2 send ACK2 NWEN 243 © , Kris Bubendorfer

Selective Repeat Can send fewer segements at the cost of making the protocol more complicated. segments are individually acknowledged Only one segment resent on timer expiry Window must bracket any unacknowledged segments window (size = 8) ack’ed sent not ack’ed available not available window (size = 8) 6 timer expires!! © , Kris Bubendorfer

Selective Repeat in Action pkt0 sent pkt1 sent pkt2 sent lost pkt3 sent ACK0 rcvd, pkt4 sent pkt0 rcvd, ACK0 sent pkt2 timeout, pkt2 sent pkt1 rcvd, ACK1 sent pkt3 rcvd, ACK3 sent pkt4 rcvd, ACK4 sent pkt5 rcvd, ACK5 sent pkt2 rcvd, ACK2 sent ACK1 rcvd, pkt5 sent NWEN 243 © , Kris Bubendorfer

PiggyBacking There is one further way to increase efficiency. ◦ Assume that any connection is duplex, ◦ with data flowing evenly back and forth. Now, we don’t need to send a separate acknowledgment, just attach to a returning data segment. NWEN 243 © , Kris Bubendorfer

Fin.