Transport layer
Transp anspor ort t se services ices and nd pr protocols ocols applicatio Provide communication between n transport application processes running on network data link physical different hosts Protocols run in end system OS Sender transport breaks up application messages, passes to network layer Receiver transport reassembles application messages, passes to applicatio destination application n transport network Two main transport protocols data link physical TCP and UDP Portland State University CS 430P/530 Internet, Web & Cloud Systems
Transp anspor ort t Layer er Func unctio tions ns Demux to upper layer Connection setup Delivery semantics Flow control Congestion control Security Portland State University CS 430P/530 Internet, Web & Cloud Systems
De Demu mux x to up uppe per r layer er (both th TCP P & UDP DP) Delivering data to correct application process Which process gets this request? Done via 16-bit source port and 16-bit destination port in both UDP and TCP HTTP NTP DNS SMTP TCP UDP Datalink IP TCP/UDP IP NET Type Protocol Port … NET 1 NET 2 NET n Field Field Number Portland State University CS 430P/530 Internet, Web & Cloud Systems
Interne ernet t service vices s la layered ered on top p of TCP/U CP/UDP DP What uses TCP? HTTP (Web pre-2016) SMTP (E-mail transmission) IMAP , POP (E-mail access) What uses (mainly) UDP? DNS NTP (network time protocol) Highly interactive on-line games (First-Person Shooters) Many protocols can use both e.g. DNS Portland State University CS 430P/530 Internet, Web & Cloud Systems
Protocols and their ports listed in /etc/services on *nix or C:\WIN*\system32\services echo 7/tcp echo 7/udp ssh 22/tcp # SSH Remote Login Protocol ssh 22/udp telnet 23/tcp smtp 25/tcp domain 53/tcp # Domain Name Server domain 53/udp http 80/tcp # WorldWideWeb HTTP http 80/udp # HyperText Transfer Protocol netbios-ssn 139/tcp # NETBIOS session service netbios-ssn 139/udp bgp 179/tcp # Border Gateway Protocol bgp 179/udp https 443/tcp # http protocol over TLS/SSL https 443/udp microsoft-ds 445/tcp # Microsoft Naked CIFS microsoft-ds 445/udp IANA http://www.iana.org/assignments/port-numbers Portland State University CS 430P/530 Internet, Web & Cloud Systems
UDP DP: : Use ser Da Datagram tagram Protocol ocol Barebones transport protocol 32 bits source port # dest port # Length, in bytes of UDP length checksum segment, including header Application data (message) UDP segment format Portland State University CS 430P/530 Internet, Web & Cloud Systems
UDP DP and nd tr transp nspor ort t layer er func unctio tions ns Demux via port numbers Connection setup (none) Connectionless No handshaking between sender and receiver Minimal state Delivery semantics Unreliable, unordered, mostly unicast No flow control support No congestion control support No security support Often used for for streaming multimedia apps and other apps that are loss tolerant, but rate sensitive Portland State University CS 430P/530 Internet, Web & Cloud Systems
TCP: P: Transm ansmiss ission ion Contr ntrol ol Protocol ocol Connection-oriented Delivery semantics Reliable, in-order byte stream Unicast (point-to-point) Full duplex (bi-directional flow) Flow and congestion controlled: Pipelined operation where size of "pipe" (i.e. bandwidth) controlled Control algorithm keeps sender from overwhelming receiver or network Done over IP via checksum, sequence numbers, acknowledgments, retransmissions, rate limits on sender application application writes data reads data socket socket door door TCP TCP send buffer receive buffer segment Portland State University CS 430P/530 Internet, Web & Cloud Systems
1. Wh . What at if if th the Da e Data ta is is C Cor orrupt rupted ed? Problem: Data Corruption GET index.html GET windex.html Internet Solution: Add a checksum X 0,9 9 6,7,8 21 4,5 7 1,2,3 6 Portland State University CS 430P/530 Internet, Web & Cloud Systems
Seg egme ment nt integrit egrity y via a checks ecksum um 32 bits Checksum included in source port # dest port # header by sender sequence number Generated by treating data in acknowledgement number the packet as numbers and head not Receive window adding them U A P R S F len used checksum Receiver performs same Urg data pnter operation as sender and Options (variable length) checks result Corruption detected when application no match data (variable length) Portland State University CS 430P/530 Internet, Web & Cloud Systems
2. Wh . What at if if th the Dat e Data a is is O Out of ut of Or Orde der? Problem: Out of Order ml inde x.th GET GET x.thindeml Solution: Add Sequence Numbers ml 4 inde 2 x.th 3 GET 1 GET index.html Portland State University CS 430P/530 Internet, Web & Cloud Systems
Seq eque uence nce num umber ers 32 bits Each segment labeled with a “ unique ” source port # dest port # number to establish ordering sequence number Allows receiver to identify which packets have been received acknowledgement number Initialized during connection setup via head not Receive window U A P R S F len used 3-way handshake checksum Urg data pnter A B Options (variable length) SYN + Seq A SYN+ACK-A + Seq B application data ACK-B (variable length) Portland State University CS 430P/530 Internet, Web & Cloud Systems
3. 3. Wh What at if if th the Dat e Data a is is L Los ost? t? Problem: Lost Data GET index.html Internet Solution: Timeout and Retransmit (implemented in OS) GET index.html GET index.html Internet GET index.html Portland State University CS 430P/530 Internet, Web & Cloud Systems
How? w? Ackno knowledgem wledgemen ents ts 32 bits TCP receiver sends an source port # dest port # acknowledgement back to sender sequence number for the data it receives acknowledgement number Sending OS keeps a copy of every head not Receive window U A P R S F len used segment it sends checksum Urg data pnter Acknowledgments allows sender to Options (variable length) “ move on ” (i.e. discard copy once it is known to have been delivered) Also lets sender know that network application has the capacity to deliver its data (variable length) packets Portland State University CS 430P/530 Internet, Web & Cloud Systems
Retran etransmi smissi ssions ons Two ways Via timeout events TCP uses single retransmission timer Sender sends segment and sets a timer If no acknowledgment received and timer goes off, retransmit Timer is based on measured round-trip times and round-trip time variations (e.g. Timeout after Average RTT + 2*standard deviation of RTT) Via missing acknowledgements If receiver reports it has received packets 1, 3, 4, and 5, sender automatically resends 2 before timeout Portland State University CS 430P/530 Internet, Web & Cloud Systems
4. What t if rec eceiv eiver er has s no res esour urces ces (flow w cont ntrol)? ol)? Problem: Overflowing receiver buffers PUT remix.mp4 Internet Solution: Receiver advertised window PUT remix.mp4 Internet 16KB free Portland State University CS 430P/530 Internet, Web & Cloud Systems
32 bits TCP P flow w contr ntrol ol source port # dest port # sequence number Receiver has a finite buffer acknowledgement number RcvBuffer Flow control to make sure sender head not Receive window U A P R S F len used won't overflow it checksum Urg data pnter Rcvr advertises spare room in buffer by including value of Options (variable length) RcvWindow in each segment/ACK Also known as the “ advertised ” application window data Sender limits unACKed data to (variable length) RcvWindow to avoid overflow Portland State University CS 430P/530 Internet, Web & Cloud Systems
5. What t if Netw etwor ork k is Ov s Over erloaded? loaded? Short bursts: buffer What if buffer overflows? Packets dropped and retransmitted Sender adjusts rate until load = resources Called “ Congestion control ” Portland State University CS 430P/530 Internet, Web & Cloud Systems
TCP P cong ngest estion ion contr trol ol Goal Prevent spurious retransmissions of packets still in flight Reduce the number of undelivered packets which consume network resources and are dropped before reaching destination Mechanism Sender keeps an internal congestion window ( cwnd ) and “ probes ” for usable bandwidth continuously Increase cwnd until loss (congestion) Decrease cwnd upon loss Size of window denotes how much network is able to absorb “ Size of the pipe ” Make cwnd as large as possible without loss Sender ’ s maximum window the minimum of receiver's advertised window and congestion window min(RcvWindow,cwnd) Portland State University CS 430P/530 Internet, Web & Cloud Systems
Recommend
More recommend