CSC 401 Data and Computer Communications Networks Transport Layer Intro, Mutliplexing/Demultiplexing, UDP Sec 3.1 3.4 Prof. Lina Battestilli Fall 2017
Chapter 3: Transport Layer our goals: understand principles behind layer services: multiplexing, demultiplexing reliable data transfer flow control congestion control learn about the Internet s layer protocols: UDP: connectionless TCP: connection-oriented reliable TCP congestion control
Transport Layer 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
Transport services and protocols provide logical communication between app processes running on different hosts protocols run in end systems Sender Side: breaks app messages into segments, passes to Network Layer Rcv Side: reassembles segments into messages, passes to Application Layer more than one protocol available to apps Internet: TCP and UDP Variants on TCP & UDP data link data link
Internet Layers Key Abstractions Application Transport Network Link Reliable or Best-Effort Streams Messages Delivery Best-effort global packet delivery Best-effort local packet delivery
Relationship b/n Transport & Network Layers Application Application byte stream Transport Data Hdr TCP Segment Network IP Data IP Hdr IP Datagram Link Link Data Link Hdr Link Frame
Relationship b/n Transport & Network Layers A A Source End-Host Application layer: logical communication between processes layer: logical communication between hosts Destination End-Host B B Application TCP TCP Network Network Network Network Link Link Link Link
Transport vs. Network Layer household analogy: sending letters to hosts = houses processes = kids app messages = letters in envelopes protocol = Ann and Bill who demux to in-house siblings -layer protocol = postal service 12 kids in Ann s house 12 kids in Bill s house:
Internet Transport Layer protocols TCP reliable, in-order delivery congestion control flow control connection setup UDP unreliable, unordered delivery no-frills extension of besteffort IP Application Transport Network Multiplexing & Demultiplexing, Error Checking NO delay guarantees & bandwidth guarantees IP is best effort delivery unreliable service Link/Physical
Transport Layer 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
Multiplexing/Demultiplexing multiplexing at sender: handle data from multiple sockets, add header (later used for demultiplexing) demultiplexing at receiver: use header info to deliver received segments to correct socket P3 link P1 P2 link P4 link socket process
How Demultiplexing works host receives IP datagrams each datagram has source IP address, destination IP address each datagram carries one layer segment each segment has source, destination port number host uses IP addresses & port numbers to direct segment to appropriate socket 32 bits source port # dest port # other header fields data (payload) segment Data Hdr TCP/UDP segment format datagram IP Data IP Hdr
Connectionless Demultiplexing create UDP socket, the layer automatically assigns it a port number You can ask for a specific port, typically done at the server side When sending into UDP socket, must specify destination IP address and destination port # 2-tuple When host receives UDP segment: checks destination port # in segment directs UDP segment to socket with that port # IP datagrams with same dest. port #, but different source IP addresses and/or source port numbers will be directed to same socket at dest
Example App: UDP Server create UDP socket bind socket to specific port Read from socket getting client s address (client IP and port) send upper case string back to this client 21
Connectionless Demux: example port #(9157); P3 link port # (6428); P1 link port#(5775); P4 link source port: 6428 dest port: 9157 source port:? dest port:? source port: 9157 dest port: 6428 source port:? dest port:?
Connection-oriented Demux TCP socket identified by 4-tuple source IP address source port number dest IP address dest port number demux: receiver uses all four values to direct segment to appropriate socket server host may support many simultaneous TCP sockets: each socket identified by its own 4-tuple web servers have different sockets for each connecting client
Example app: TCP server create TCP welcoming socket Server begins listening for incoming TCP requests NEW socket created read bytes from socket (but not address as in UDP) close connection to this client (but NOT welcoming socket) 24
Connection-oriented demux: example host: IP address A P3 link source IP,port: B,80 dest IP,port: A,9157 server: IP address B source IP,port: A,9157 dest IP, port: B,80 P4 P5 link P6 three segments, all destined to IP address: B, dest port: 80 are demultiplexed to different sockets P2 link source IP,port: C,5775 dest IP,port: B,80 source IP,port: C,9157 dest IP,port: B,80 P3 host: IP address C
Connection-oriented demux: example threaded server P3 link P4 link server: IP address B P2 link P3 host: IP address A source IP,port: B,80 dest IP,port: A,9157 source IP,port: C,5775 dest IP,port: B,80 host: IP address C source IP,port: A,9157 dest IP, port: B,80 source IP,port: C,9157 dest IP,port: B,80
Transport Layer 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
UDP: User Datagram Protocol [RFC 768] no frills, bare bones Internet protocol best effort service, UDP segments may be: lost delivered out-of-order to app Connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of all other UDP segments
UDP Uses Application Remote File Server Streaming multimedia Internet telephony Network Management Application Protocol NFS Typically proprietary Typically proprietary SNMP Transport Protocol UDP UDP or TCP UDP or TCP Typically UDP why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small header size no congestion control: UDP can blast away as fast as desired Routing protocol Name Translation RIP DNS Typically UDP Typically UDP over UDP: add reliability at layer -specific error recovery!
UDP: segment header length, in bytes of UDP segment, including header 32 bits source port # dest port # length checksum Error Detection data (payload) UDP segment format
UDP checksum Goal: detect errors (e.g., flipped bits) in transmitted segment sender: treat segment contents, including header fields, as sequence of 16-bit integers checksum: addition (one s complement sum) of segment contents sender puts checksum value into UDP checksum field receiver: compute checksum of received segment check if computed checksum equals checksum field value: Error detected No error detected. But maybe errors nonetheless? Why does UDP provide a checksum? End-to-end principle
Internet checksum: example example: add two 16-bit integers 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 wraparound sum checksum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 Note: when adding numbers, a carryout from the most significant bit needs to be added to the result Not Error Correction!
References Some of the slides are identical or derived from 1. Slides for the 7 th edition of the book Kurose & Ross, Computer Networking: A Top-Down Approach, 2. Nick Feamster COS 461: Computer Networking, Spring 2016 3. Computer Networking, Nick McKeown and Philip Levis, 2014 Stanford University