11Transport Layer2Chapter 3: Transport LayerOur goals: understandprinciples behindtransport layerservices: multiplexing/demultiplexing reliable datatransfer flow control congestion control learn about transportlayer protocols in theInternet: UDP: connectionlesstransport TCP: connection-oriented transport TCP congestion control3Chapter 3 outline 3.1 Transport-layerservices 3.2 Multiplexing anddemultiplexing 3.3 Connectionlesstransport: UDP 3.4 Principles ofreliable data transfer 3.5 Connection-orientedtransport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles ofcongestion control 3.7 TCP congestioncontrol4Transport services and protocols provide logical communicationbetween app processesrunning on different hosts transport protocols run in endsystems send side: breaks appmessages into segments,passes to network layer rcv side: reassemblessegments into messages,passes to app layer more than one transportprotocol available to apps Internet: TCP and UDPapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicallogical end-end transport5Transport vs. network layer network layer:logicalcommunicationbetween hosts transport layer:logicalcommunicationbetween processes relies on, enhances,network layerservicesHousehold analogy:sending letters processes = people app messages = lettersin envelopes hosts = houses transport protocol =sorting and collectingmail within house network-layer protocol =postal service6Internet transport-layer protocols reliable, in-order delivery(TCP) congestion control flow control connection setup unreliable, unordereddelivery: UDP no-frills extension of“best-effort” IP services not available: delay guarantees bandwidth guaranteesapplicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicallogical end-end transport27Chapter 3 outline 3.1 Transport-layerservices 3.2 Multiplexing anddemultiplexing 3.3 Connectionlesstransport: UDP 3.4 Principles ofreliable data transfer 3.5 Connection-orientedtransport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles ofcongestion control 3.7 TCP congestioncontrol8Multiplexing/demultiplexingapplicationtransportnetworklinkphysicalP1applicationtransportnetworklinkphysicalapplicationtransportnetworklinkphysicalP2P3P4P1host 1host 2host 3= process= socketdelivering received segmentsto correct socketDemultiplexing at rcv host:gathering data from multiplesockets, enveloping data with header (later used for demultiplexing)Multiplexing at send host:9How demultiplexing works host receives IP datagrams each datagram has sourceIP address, destination IPaddress each datagram carries 1transport-layer segment each segment has source,destination port number host uses IP addresses & portnumbers to direct segment toappropriate socketsource port # dest port #32 bitsapplicationdata (message)other header fieldsTCP/UDP segment format10Connectionless demultiplexing Create sockets with portnumbers:sin1.sin_port = 1234;bind(socket1, &sin1, …);sin2.sin_port = 1235;bind(socket2, &sin2, …); UDP socket identified bytwo-tuple:(dest IP address, dest port number) When host receives UDPsegment: checks destination portnumber in segment directs UDP segment tosocket with that portnumber IP datagrams withdifferent source IPaddresses and/or sourceport numbers directed tosame socket11Connectionless demux (cont)sin.sin_port = 6428; bind(sock, &sin, …);ClientIP:BP2client IP: AP1P1P3serverIP: CSP: 6428DP: 9157SP: 9157DP: 6428SP: 6428DP: 5775SP: 5775DP: 6428SP provides “return address”(returned by recvfrom)12Connection-oriented demux TCP socketidentified by 4-tuple: source IP address source port number dest IP address dest port number recv host uses allfour values to directsegment toappropriate socket Server host may supportmany simultaneous TCPsockets: each socket identified byits own 4-tuple Web servers havedifferent sockets for eachconnecting client non-persistent HTTP willhave different socket foreach request313Connection-oriented demux (cont)ClientIP:BP1client IP: AP1P2P4serverIP: CSP: 9157DP: 80SP: 9157DP: 80P5P6P3D-IP:CS-IP: AD-IP:CS-IP: BSP: 5775DP: 80D-IP:CS-IP: B14Connection-oriented demux:Threaded Web ServerClientIP:BP1client IP: AP1P2serverIP: CSP: 9157DP: 80SP: 9157DP: 80P4 P3D-IP:CS-IP: AD-IP:CS-IP: BSP: 5775DP: 80D-IP:CS-IP: B15Chapter 3 outline 3.1 Transport-layerservices 3.2 Multiplexing anddemultiplexing 3.3 Connectionlesstransport: UDP 3.4 Principles ofreliable data transfer 3.5 Connection-orientedtransport: TCP segment structure reliable data transfer flow control connection management 3.6 Principles ofcongestion control 3.7 TCP congestioncontrol16UDP: User Datagram Protocol [RFC 768] “no frills,” “bare bones”Internet transport protocol “best effort” service, UDPsegments may be: lost delivered out of order toapp connectionless: no handshakingbetween UDP sender,receiver each UDP segmenthandled independentlyof othersWhy is there a UDP? no connectionestablishment (whichcan add delay) simple: no connectionstate at sender, receiver small segment header no congestion control:UDP can blast away asfast as desired17UDP: more often used forstreaming multimediaapps loss tolerant rate sensitive other UDP uses DNS SNMP reliable transfer overUDP: add reliability atapplication layer application-specificerror recovery!source port # dest port #32 bitsApplicationdata (message)UDP segment formatlengthchecksumLength, inbytes of UDPsegment,includingheader18UDP checksumSender: treat segment contentsas sequence of 16-bitintegers checksum: addition(1’s complement sum)of segment contents sender puts checksumvalue into UDPchecksum fieldReceiver: compute checksum ofreceived segment check if computed checksumequals checksum field value: NO - error detected YES - no error detected.But maybe errorsnonetheless? More later….Goal: detect
View Full Document