SLIIT University IE1030 Data Communication Networks 07 Transport Layer PDF
Document Details
Uploaded by Deleted User
SLIIT
2024
null
Nimal Ratnayake
Tags
Summary
These lecture slides cover the transport layer in computer networks. They explain transport-layer services, connectionless (UDP) and connection-oriented (TCP) transports, reliable data transfer principles, as well as TCP management, sequence numbers, acknowledgements, flow control, and retransmission methods.
Full Transcript
IE1030 – Data Communication Networks 07 – Transport Layer Year 1 – Semester 1 – 2024 October Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection...
IE1030 – Data Communication Networks 07 – Transport Layer Year 1 – Semester 1 – 2024 October Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-2 Key terms and concepts Socket Port numbers Transport layer multiplexing and demultiplexing Connection oriented protocols Connectionless protocols Flow control Congestion control IE1030 Data Communication Networks – Transport Layer 7-3 Services, Layering and Encapsulation application message M M application transport segment Ht M Ht M transport network datagram Hn Ht M Hn Ht M network link frame Hl Hn Ht M Hl Hn Ht M link physical physical source This slide is from topic 2 (Protocol Architecture) destination IE1030 Data Communication Networks – Transport Layer 7-4 Why do we need a transport layer Services provided by the network layer (IP protocol) Unreliable: Delivery is not guaranteed Best effort: Some datagrams may be dropped due to congestion etc. Connectionless: Each datagram is treated independently from others Datagrams can reach the destination out-of-order Applications may need reliability Also need a mechanism to identify multiple applications on the same host Something in addition to the network layer (IP)address Transport layer adds the concept of port numbers Application X: IP address aaa.bbb.ccc.ddd and port xxx Application Y: IP address aaa.bbb.ccc.ddd and port yyy IE1030 Data Communication Networks – Transport Layer 7-5 Transport services and protocols application transport ▪ provide logical communication mobile network network data link physical between application processes national or global ISP running on different hosts ▪ transport protocols actions in end systems: local or sender: breaks application messages regional ISP into segments, passes to network layer home network content receiver: reassembles segments into provider network datacenter messages, passes to application layer application transport network network ▪ two transport protocols available to data link physical Internet applications enterprise network TCP, UDP IE1030 Data Communication Networks – Transport Layer 7-6 Transport vs. network layer services and protocols household analogy: 12 kids in Ann’s house sending letters to 12 kids in Bill’s house: ▪ hosts = houses ▪ processes = kids ▪ app messages = letters in envelopes ▪ transport protocol = Ann and Bill who demux to in-house siblings ▪ network-layer protocol = postal service IE1030 Data Communication Networks – Transport Layer 7-7 Transport vs. network layer services and protocols household analogy: ▪transport layer: 12 kids in Ann’s house sending communication between letters to 12 kids in Bill’s processes house: relies on, enhances, network ▪ hosts = houses layer services ▪ processes = kids ▪ app messages = letters in envelopes ▪network layer: ▪ transport protocol = Ann and Bill communication between who demux to in-house siblings hosts ▪ network-layer protocol = postal service IE1030 Data Communication Networks – Transport Layer 7-8 Sockets A process in the Application Layer connects to the Transport Layer via a socket application socket A socket is an endpoint for sending or receiving data across a network process Sockets are created by application layer processes transport A socket is connected to only one process network A socket is uniquely identified by an IP link address and the port number physical Port number: A numerical identifier that represents a specific process or service on the host The Port number is specified using 16-bits Port number can range from 0 to 65535 IE1030 Data Communication Networks – Transport Layer 7-9 Transport Layer Actions Sender: application ▪ is passed an application- application app. msg layer message transport ▪ determines segment Htt transport H app. msg header fields values network (IP) ▪ creates segment network (IP) link ▪ passes segment to IP link physical physical IE1030 Data Communication Networks – Transport Layer 7-10 Transport Layer Actions Receiver: application ▪ receives segment from IP application ▪ checks header values transport app. msg ▪ extracts application-layer transport message network (IP) network (IP) ▪ demultiplexes message up link to application via socket link physical physical Ht app. msg IE1030 Data Communication Networks – Transport Layer 7-11 Two principal Internet transport protocols application transport ▪ TCP: Transmission Control Protocol mobile network network data link physical reliable, in-order delivery national or global ISP congestion control flow control connection setup local or ▪ UDP: User Datagram Protocol regional ISP unreliable, unordered delivery home network content provider no-frills extension of “best-effort” IP network datacenter application network ▪ services not available: transport network data link delay guarantees physical bandwidth guarantees enterprise network IE1030 Data Communication Networks – Transport Layer 7-12 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-13 Multiplexing/demultiplexing multiplexing as sender: demultiplexing as receiver: handle data from multiple use header info to deliver sockets, add transport header received segments to correct (later used for demultiplexing) socket application application P1 P2 application socket P3 transport P4 process transport network transport network link network link physical link physical physical IE1030 Data Communication Networks – Transport Layer 7-14 HTTP server client application application HTTP msg transport Ht HTTP msg Hnnetwork Ht HTTP msg transport transport Hn Hnetwork t HTTP msg link network link physical link physical physical Hn Ht HTTP msg IE1030 Data Communication Networks – Transport Layer 7-15 Q: how did transport layer know to deliver message to Firefox browser process rather then Netflix process or Skype process? client application application HTTP msg HTTP msg transport Ht HTTP msg transport network transport network link network link physical link physical physical IE1030 Data Communication Networks – Transport Layer 7-16 ? de-multiplexing IE1030 Data Communication Networks – Transport Layer 7-17 application ? transport de-multiplexing IE1030 Data Communication Networks – Transport Layer 7-18 multiplexing IE1030 Data Communication Networks – Transport Layer 7-19 application transport multiplexing IE1030 Data Communication Networks – Transport Layer 7-20 Multiplexing 7-21 Demultiplexing 7-22 How demultiplexing works ▪ host receives IP datagrams 32 bits each datagram has source IP source port # dest port # address, destination IP address each datagram carries one other header fields transport-layer segment each segment has source, application destination port number data ▪ host uses IP addresses & port (payload) numbers to direct segment to appropriate socket TCP/UDP segment format IE1030 Data Communication Networks – Transport Layer 7-23 Connectionless demultiplexing ▪ when a process creates a when receiving host receives socket, it must specify the port UDP segment: checks destination port # in number (source port #) segment directs UDP segment to socket with that port # ▪ when creating datagram to send into UDP socket, must specify IP/UDP datagrams with same dest. port #, but different source IP destination IP address addresses and/or source port destination port # numbers will be directed to same socket at receiving host IE1030 Data Communication Networks – Transport Layer 7-24 Connectionless demultiplexing: an example P1 uses port 6428 P3 uses port 9157 P4 uses port 5775 application application application P1 P3 P4 transport transport transport network network link network link physical link physical physical B D source port: 6428 source port: ? dest port: 9157 dest port: ? A C source port: 9157 source port: ? dest port: 6428 dest port: ? IE1030 Data Communication Networks – Transport Layer 7-25 Connection-oriented demultiplexing ▪ TCP socket identified by ▪ server may support many 4-tuple: simultaneous TCP sockets: source (local) IP address each socket identified by its source (local) port number own 4-tuple dest (remote) IP address each socket associated with dest (remote) port number a different connecting client ▪ demux: receiver uses all four values (4-tuple) to direct segment to appropriate socket IE1030 Data Communication Networks – Transport Layer 7-26 Connection-oriented demultiplexing: example application application P4 P5 P6 application P1 P2 P3 transport transport transport network network link network link physical link physical server: IP physical address B host: IP source IP,port: B,80 host: IP address A dest IP,port: A,9157 source IP,port: C,5775 address C dest IP,port: B,80 source IP,port: A,9157 dest IP, port: B,80 source IP,port: C,9157 dest IP,port: B,80 Three segments, all destined to IP address: B, dest port: 80 are demultiplexed to different sockets IE1030 Data Communication Networks – Transport Layer 7-27 Summary ▪ Multiplexing, demultiplexing: based on segment, datagram header field values ▪ UDP: demultiplexing using destination port number (only) ▪ TCP: demultiplexing using 4-tuple: source and destination IP addresses, and port numbers IE1030 Data Communication Networks – Transport Layer 7-28 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-29 UDP: User Datagram Protocol Why is there a UDP? ▪ “no frills,” “bare bones” Internet transport protocol ▪ no connection establishment (which can ▪ “best effort” service, UDP add RTT delay) segments may be: ▪ simple: no connection state lost at sender, receiver delivered out-of-order to app ▪ small header size ▪ connectionless: ▪ no congestion control no handshaking between UDP ▪ UDP can blast away as fast as desired! sender, receiver ▪ can function in the face of each UDP segment handled congestion independently of others IE1030 Data Communication Networks – Transport Layer 7-30 UDP: User Datagram Protocol ▪ UDP use: ▪ streaming multimedia apps (loss tolerant, rate sensitive) ▪ DNS ▪ SNMP ▪ HTTP/3 ▪ if reliable transfer needed over UDP (e.g., HTTP/3): ▪ add needed reliability at application layer ▪ add congestion control at application layer IE1030 Data Communication Networks – Transport Layer 7-31 UDP: User Datagram Protocol [RFC 768] IE1030 Data Communication Networks – Transport Layer 7-32 UDP: Transport Layer Actions SNMP client SNMP server application application transport transport (UDP) (UDP) network (IP) network (IP) link link physical physical IE1030 Data Communication Networks – Transport Layer 7-33 UDP: Transport Layer Actions SNMP client SNMP server UDP sender actions: application ▪ is passed an application- application SNMP msg layer message transport transport ▪ determines UDP segment UDP UDPhh SNMP msg (UDP) header fields values (UDP) network (IP) ▪ creates UDP segment network (IP) link ▪ passes segment to IP link physical physical IE1030 Data Communication Networks – Transport Layer 7-34 UDP: Transport Layer Actions SNMP client SNMP server UDP receiver actions: application ▪ receives segment from IP application ▪ checks UDP checksum transport transport SNMP msg header value (UDP) (UDP) ▪ extracts application-layer network UDP h SNMP(IP) msg message network (IP) ▪ demultiplexes message up link link to application via socket physical physical IE1030 Data Communication Networks – Transport Layer 7-35 UDP segment header 32 bits source port # dest port # length checksum application length, in bytes of data UDP segment, (payload) including header data to/from UDP segment format application layer IE1030 Data Communication Networks – Transport Layer 7-36 Summary: UDP ▪ “no frills” protocol: segments may be lost, delivered out of order best effort service: “send and hope for the best” ▪ UDP has its plusses: no setup/handshaking needed (no RTT incurred) can function when network service is compromised helps with reliability (checksum) ▪ build additional functionality on top of UDP in application layer (e.g., HTTP/3) IE1030 Data Communication Networks – Transport Layer 7-37 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-38 Principles of reliable data transfer sending receiving process process application data data transport reliable channel reliable service abstraction IE1030 Data Communication Networks – Transport Layer 7-39 Principles of reliable data transfer sending receiving sending receiving process process process process application data data application data data transport transport reliable channel sender-side of receiver-side reliable service abstraction reliable data of reliable data transfer protocol transfer protocol transport network unreliable channel reliable service implementation IE1030 Data Communication Networks – Transport Layer 7-40 Principles of reliable data transfer sending receiving process process application data data transport sender-side of receiver-side Complexity of reliable data reliable data transfer protocol of reliable data transfer protocol transfer protocol will depend (strongly) on characteristics of transport network unreliable channel (lose, unreliable channel corrupt, reorder data?) reliable service implementation IE1030 Data Communication Networks – Transport Layer 7-41 Principles of reliable data transfer sending receiving process process application data data transport sender-side of receiver-side reliable data of reliable data Sender, receiver do not know transfer protocol transfer protocol the “state” of each other, e.g., was a message received? transport network ▪ unless communicated via a unreliable channel message reliable service implementation IE1030 Data Communication Networks – Transport Layer 7-42 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-43 TCP: overview RFCs: 793,1122, 2018, 5681, 7323 ▪ point-to-point: ▪ connection-oriented: one sender, one receiver Three-way handshaking (exchange ▪ full duplex data: of control messages) establishes connection before data exchange bi-directional data flow in same connection ▪ cumulative ACKs MSS: maximum segment size receiver acknowledges the last byte number received ▪ reliable, in-order byte steam: ▪ flow controlled: Bytes in each direction of a sender will not overwhelm receiver connection are numbered ▪ pipelining: sequentially TCP congestion and flow control set window size IE1030 Data Communication Networks – Transport Layer 7-44 TCP segment structure 32 bits source port # dest port # segment seq #: counting ACK: seq # of next expected sequence number bytes of data into bytestream byte; A bit: this is an ACK (not segments!) acknowledgement number head not length (of TCP header) len used C EUAP R SF receive window flow control: # bytes Internet checksum checksum Urg data pointer receiver willing to accept options (variable length) C, E: congestion notification TCP options application data sent by RST, SYN, FIN: connection data application into management (variable length) TCP socket IE1030 Data Communication Networks – Transport Layer 7-45 TCP State Diagram IE1030 Data Communication Networks – Transport Layer 7-46 TCP State sequence (Client) Typical sequence of states visited by a client IE1030 Data Communication Networks – Transport Layer 7-47 TCP State sequence (Server) Typical sequence of states visited by a server IE1030 Data Communication Networks – Transport Layer 7-48 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-49 TCP connection establishment before exchanging data, sender/receiver perform a “three-way-handshake”: ▪ agree to establish connection (each knowing the other willing to establish connection) ▪ agree on connection parameters (e.g., starting seq #s, receive buffer sizes) application application connection state: ESTAB connection state: ESTAB connection variables: connection Variables: seq # client-to-server seq # client-to-server server-to-client server-to-client rcvBuffer size rcvBuffer size at server,client at server,client network network Socket clientSocket = Socket connectionSocket = newSocket("hostname","port number"); welcomeSocket.accept(); IE1030 Data Communication Networks – Transport Layer 7-50 TCP 3-way handshake Notation: ACK=79 means ACK flag (A) is 1 and Server state Acknowlegment number =79 serverSocket = socket(AF_INET,SOCK_STREAM) Client state ACK=0 means ACK flag (A) is 0 serverSocket.bind((‘’,serverPort)) serverSocket.listen(1) clientSocket = socket(AF_INET, SOCK_STREAM) connectionSocket, addr = serverSocket.accept() CLOSED clientSocket.connect((serverName,serverPort)) LISTEN choose init seq num, x send TCP SYN msg SYN=1, Seq=x SYNSENT ACK=0 choose init seq num, y send TCP SYNACK msg, acking SYN SYN RCVD SYN=1, Seq=y ACK=x+1 received SYNACK(x) ESTAB indicates server is live; send ACK for SYNACK; Seq=x, this segment may contain client-to-server data ACK=y+1 received ACK(y) indicates client is live ESTAB IE1030 Data Communication Networks – Transport Layer 7-51 Closing a TCP connection ▪ client, server each close their side of connection send TCP segment with FIN bit = 1 ▪ respond to received FIN with ACK on receiving FIN, ACK can be combined with own FIN ▪ simultaneous FIN exchanges can be handled IE1030 Data Communication Networks – Transport Layer 7-52 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-53 TCP sequence numbers Host B Host A server client 0 1 Sequence numbers from A to B N N+1 Application layer data from A to B (for the entire duration of the connection) 0 1 Sequence numbers from B to A M M+1 FIN SYN Application layer data from B to A (for the entire duration of the connection) SYN+ACK FIN In practice, sequence numbers in each direction start at a random number instead of 0 SYN, SYN+ACK and FIN segments are considered to have one byte of data although in reality they do not contain any data. IE1030 Data Communication Networks – Transport Layer 7-54 TCP sequence numbers and ACKs Host B Host A server client X X+1 X+N1+1 X+N1+N2+1 Sequence numbers from A to B X+N X+N+1 Data segment 1 Data segment 2 ………. Data segment k N1 bytes N2 bytes Nk bytes SYN FIN Let’s say that data from A to B is sent in k segments (Segment numbers 1,2,…k) Size (no. of bytes) of segments are N1, N2,…, Nk and N = N1+N2+…+Nk After receiving a segment, the recipient is supposed to acknowledge (ACK) with Acknowledgement number = sequence number of next byte expected After receiving segment 1, B can respond with ACK = X +N1+1 After receiving segment 2, B can respond with ACK = X +N1+N2+1 Acknowledgements are cumulative Instead of sending two ACKs as above, B can send only one ACK with ACK = X +N1+N2+1 after receiving segment 2 IE1030 Data Communication Networks – Transport Layer 7-55 TCP sequence numbers and ACKs Host B Host A server client X X+1 X+N1+1 X+N1+N2+1 Sequence numbers from A to B X+N X+N+1 Data segment 1 Data segment 2 ………. Data segment k N1 bytes N2 bytes Nk bytes SYN Y+M1+M2+1 Seq. numbers from B to A FIN Y Y+1 Y+M1+1 Y+M Y+M+1 Data segment 1 Data segment 2 ………. M1 bytes M2 bytes SYN+ACK FIN Sending an ACK segment with no data is wasteful Recipient can combine an ACK with one of its own data segments B can combine ACK for A’s segment 1 with its own segment 2 B’s segment 2 can have Seq. no = Y +M1+1 and ACK = X +N1+1 IE1030 Data Communication Networks – Transport Layer 7-56 TCP sequence numbers, ACKs Host A Host B User types‘C’ Seq=42, ACK=79, data = ‘C’ host ACKs receipt of‘C’, echoes back ‘C’ Seq=79, ACK=43, data = ‘C’ host ACKs receipt Notation: ACK=79 means that the of echoed ‘C’ ACK flag (A) is 1 and ACKnum=79 Seq=43, ACK=80 simple telnet scenario IE1030 Data Communication Networks – Transport Layer 7-57 Example: TCP client and server Client host A is communicating with server B A B listening on TCP port 2000. SYN Client opens the TCP connection to the SYN + ACK server, and then sends the text message ACK Hello! Data When the message is received by server, it Data responds with the text message Welcome! FIN Upon receiving the text message from server, ACK client closes the TCP connection FIN Finally, server also closes the connection ACK IE1030 Data Communication Networks – Transport Layer 7-58 Example: TCP client and server (2) Let’s say A’s Seq. No. starts at 10000 and A B B’s Seq. No. starts at 20000 All segments except A3 and B2 have no A1 A1: Seq=10000, SYN=1 data (i.e. Len=0) SYN B1: Seq=20000, SYN=1, ACK=1 SYN + ACK B1 A2 A2: Seq=10001, ACK=20001 SYN, SYN+ACK, and ACK A3 A3: Seq=10001, ACK=20001, Len=6, FIN Segments are considered to have a Data Data=“Hello!” length of 1 byte, Data B2 B2: Seq=20001, ACK=10007, Len=8, although actually A4 Data=“Welcome!” have zero length FIN B3 A4: Seq=10007, ACK=20009, FIN=1 ACK FIN B4 B3: Seq=20009, ACK=10008 A5 B4: Seq=20009, ACK=10008, FIN=1 ACK A5: Seq=10008, ACK=20010 IE1030 Data Communication Networks – Transport Layer 7-59 Exercise: TCP client and server Exercise: A B Two of the segments shown here (one from A A1 and one from B) can be combined with the next SYN B1 segment from the same host, to reduce the A2 SYN + ACK ACK total number of segments in the connection. A3 Data Can you identify the two segments? Data B2 Hint: Check all the segments with no data. A4 FIN ACK B3 FIN B4 A5 ACK IE1030 Data Communication Networks – Transport Layer 7-60 TCP Receiver: ACK generation [RFC 5681] Event at receiver TCP receiver action arrival of in-order segment with delayed ACK. Wait up to 500ms expected seq #. All data up to for next segment. If no next segment, expected seq # already ACKed send ACK arrival of in-order segment with immediately send single cumulative expected seq #. One other ACK, ACKing both in-order segments segment has ACK pending arrival of out-of-order segment immediately send duplicate ACK, higher-than-expect seq. #. indicating seq. # of next expected byte Gap detected arrival of segment that immediately send ACK, provided that partially or completely fills gap segment starts at lower end of gap IE1030 Data Communication Networks – Transport Layer 7-61 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-62 TCP flow control Q: What happens if network application process layer delivers data faster than Application removing application layer removes data from TCP socket buffers data from socket buffers? TCP socket receiver buffers rwnd : # bytes receiver receive window willing to accept TCP code Network layer delivering IP datagram payload into TCP socket buffers IP code flow control receiver controls sender, so that sender won’t overflow receiver’s from sender buffer by sending too much, too fast receiver protocol stack IE1030 Data Communication Networks – Transport Layer 7-63 Transport Layer: 3-63 TCP flow control ▪ TCP receiver “advertises” free buffer space in rwnd field in TCP header to application process RcvBuffer size set via socket options (typical default is 4096 bytes) many operating systems auto-adjust RcvBuffer buffered data RcvBuffer Initially rwnd = RcvBuffer rwnd free buffer space ▪ sender limits amount of unACKed (“in-flight”) data to receiver’s rwnd TCP segment payloads ▪ LastByteSent – LastByteACKed ≤ rwnd TCP receiver-side buffering ▪ guarantees receive buffer will not overflow IE1030 Data Communication Networks – Transport Layer 7-643-64 Transport Layer: Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers and acknowledgements TCP Flow control TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-65 TCP retransmission Host A Host B If an ACK is not received within a certain time period after sending a segment, TCP will Seq=92, 8 bytes of data retransmit the segment timeout This is called the Timeout period Seq=92, 8 bytes of data IE1030 Data Communication Networks – Transport Layer 7-66 TCP round trip time (RTT), timeout Q: how to set TCP timeout Q: how to estimate RTT? value? ▪ SampleRTT:measured time ▪ Should be longer than RTT, but from segment transmission until RTT varies! ACK receipt ignore retransmissions ▪ too short: premature timeout, unnecessary retransmissions ▪ SampleRTT will vary, want estimated RTT “smoother” ▪ too long: slow reaction to average several recent segment loss measurements, not just current SampleRTT IE1030 Data Communication Networks – Transport Layer 7-67 TCP round trip time (RTT), timeout (2) EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT ▪ exponential weighted moving average (EWMA) ▪ influence of past sample decreases exponentially fast RTT: gaia.cs.umass.edu to fantasia.eurecom.fr ▪ typical value: = 0.125 350 RTT: gaia.cs.umass.edu to fantasia.eurecom.fr RTT (milliseconds) 300 250 RTT (milliseconds) 200 sampleRTT 150 EstimatedRTT 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) time (seconds) IE1030 Data Communication Networks – Transport Layer SampleRTT Estimated RTT 7-68 TCP Sender (simplified) event: data received from event: timeout application ▪ retransmit segment that caused timeout ▪ create segment with seq # ▪ restart timer ▪ seq # is byte-stream number of first data byte in segment event: ACK received ▪ start timer if not already running ▪ if ACK acknowledges previously unACKed segments think of timer as for oldest unACKed segment update what is known to be ACKed expiration interval: TimeOutInterval start timer if there are still unACKed segments IE1030 Data Communication Networks – Transport Layer 7-69 TCP: retransmission scenarios Host A Host B Host A Host B SendBase=92 Seq=92, 8 bytes of data Seq=92, 8 bytes of data Seq=100, 20 bytes of data timeout timeout ACK=100 X ACK=100 ACK=120 Seq=92, 8 bytes of data Seq=92, 8 SendBase=100 bytes of data send cumulative SendBase=120 ACK for 120 ACK=100 ACK=120 SendBase=120 lost ACK scenario premature timeout IE1030 Data Communication Networks – Transport Layer 7-70 TCP: retransmission scenarios Host A Host B Seq=92, 8 bytes of data Seq=100, 20 bytes of data ACK=100 X ACK=120 Seq=120, 15 bytes of data cumulative ACK covers for earlier lost ACK IE1030 Data Communication Networks – Transport Layer 7-71 TCP fast retransmit Host A Host B TCP fast retransmit if sender receives 3 additional ACKs for same data (“triple duplicate ACKs”), resend unACKed segment with smallest seq # X ▪ likely that unACKed segment lost, so don’t wait for timeout timeout Receipt of three duplicate ACKs indicates 3 segments received after a missing segment – lost segment is likely. So retransmit! IE1030 Data Communication Networks – Transport Layer 7-72 Lesson outline Transport-layer services Multiplexing and demultiplexing Connectionless transport: UDP Principles of reliable data transfer Connection-oriented transport: TCP TCP connection management TCP Sequence numbers, acknowledgements TCP retransmission IE1030 Data Communication Networks – Transport Layer 7-73 References Chapter 3 - The Transport Layer James F. Kurose and Keith W. Ross, Computer Networking – A Top-Down Approach, (8th Edition), Pearson, 2020 Chapter 15 - Transport Protocols William Stallings, Data and Computer Communications (10th Edition), Pearson, 2014 IE1030 Data Communication Networks – Transport Layer 7-74 Lecture slides prepared by Nimal Ratnayake Dept of Computer Systems Engineering SLIIT First version: 2024 July Revision 1: 2024 October 7-75