IS370 Data Communications and Computer Networks. Chapter 5 : Transport Layer

Similar documents
Unit 2.

Chapter 24. Transport-Layer Protocols

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

TSIN02 - Internetworking

TSIN02 - Internetworking

TSIN02 - Internetworking

23-3 TCP. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control 23.22

05 Transmission Control Protocol (TCP)

User Datagram Protocol (UDP):

TSIN02 - Internetworking

CCNA Exploration Network Fundamentals. Chapter 04 OSI Transport Layer

UNIT IV TRANSPORT LAYER

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Networking Technologies and Applications

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

User Datagram Protocol

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Stream Control Transmission Protocol

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

OSI Transport Layer. objectives

Lecture 3: The Transport Layer: UDP and TCP

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

ITS323: Introduction to Data Communications

TCP : Fundamentals of Computer Networks Bill Nace

Transport Layer: outline

CSC 4900 Computer Networks: TCP

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

Chapter 11. User Datagram Protocol (UDP)

4.0.1 CHAPTER INTRODUCTION

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

CCNA R&S: Introduction to Networks. Chapter 7: The Transport Layer

CSCD 330 Network Programming

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

CSC 401 Data and Computer Communications Networks

CS457 Transport Protocols. CS 457 Fall 2014

CSCE 463/612 Networks and Distributed Processing Spring 2017

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Computer Communication Networks Midterm Review

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

TCP/IP Protocol Suite 1

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 9

10 minutes survey (anonymous)

Transport Protocols. Raj Jain. Washington University in St. Louis

Transport Layer: Outline

TCP: Flow and Error Control

UNIT V. Computer Networks [10MCA32] 1

ECE697AA Lecture 3. Today s lecture

Computer Networking Introduction

CSE 4213: Computer Networks II

Chapter 3 Transport Layer

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

UNIT IV -- TRANSPORT LAYER

7. TCP 최양희서울대학교컴퓨터공학부

ICMP. Outline ICMP. ICMP oicmp is provided within IP which generates error. Internet Control Message Protocol. Ping Traceroute

Chapter 3 Transport Layer

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Transport Protocols and TCP

Process-to-Process Delivery:

Transport Protocols & TCP TCP

Internet and Intranet Protocols and Applications

Sequence Number. Acknowledgment Number. Data

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

COMP 431 Internet Services & Protocols. Transport Layer Protocols & Services Outline. The Transport Layer Reliable data delivery & flow control in TCP

Transmission Control Protocol (TCP)

NT1210 Introduction to Networking. Unit 10

QUIZ: Longest Matching Prefix

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Topics. TCP sliding window protocol TCP PUSH flag TCP slow start Bulk data throughput

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

ECE 435 Network Engineering Lecture 9

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

TCP = Transmission Control Protocol Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.

EE 122: Transport Protocols: UDP and TCP

Introduction to Networks and the Internet

Process-la-Process Delivery: UDp, TCp, and SCTP

Chapter 3- parte B outline

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

The Transport Layer: TCP & Reliable Data Transfer

TCP/IP-2. Transmission control protocol:

Department of Computer and IT Engineering University of Kurdistan. Transport Layer. By: Dr. Alireza Abdollahpouri

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

CS321: Computer Networks Error and Flow Control in TCP

UDP, TCP, IP multicast

Chapter III: Transport Layer

CS 716: Introduction to communication networks th class; 7 th Oct Instructor: Sridhar Iyer IIT Bombay

Fall 2012: FCM 708 Bridge Foundation I

CSC 634: Networks Programming

Lecture 5. Transport Layer. Transport Layer 1-1

Transcription:

IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh Introduction Transport layer is responsible on process-to-process delivery of the entire message. It ensures the delivery of the entire message while the network layer treats each packet individually. These packets could belong to the same message or to different messages. Process-to-process means the delivery from a specific process on a computer toanother process on another computer. => includes a type of address in the transport layer header called : OSI: service-point address. /IP: port address. A transport layer can be either connectionless or connectionoriented. The transport layer may be responsible for the flow and error control. Flow control and error control are performed end to end. The Internet transport layer protocols are: UDP,, and SCTP. 1 2 IS370- Mr Mourad Benchikh Page 1

Process-to-process delivery Need to a process-to-process delivery. A process is an application program. Several processes can be running on the source host and several on the destination host. Network layer host-to-host delivery is not enough To complete the delivery: need to deliver data from one of these running processes on the source host to the corresponding one on the destination host. Client/server paradigm Two processes can commonly communicate through a client/server paradigm. A process on the local host, i.e. a client, needs services from a process usually on a remote host, i.e. a server. Both the processes have the same name. Addressing A transport layer address, called port number, is needed to choose among multiple processes running on the destination host. The destination port number is needed for the delivery The source port number is needed for the reply. Internet model port number is on 16-bit integers (i.e. [0, 65535]). The client program defines itself with a port number randomly chosen (ephemeral port number) by the transport layer. The server process must also define itself with a port number but with a well-known port number. => to let the corresponding client process, on any host, always be able to request for this server services. IANA (Internet Assigned Number authority) has divided the port numbers into three categories [RFC 1700, 3232]: 1) wellknown ports[0,1023] are reserved, 2) registered ports[1024,49151]: not assigned or controlled by IANA but only registered with IANA to prevent duplication, 3) Dynamic ports (ephemeral ports) [49152, 65535] neither controlled nor registered by IANA. Process-to-process delivery Client/server paradigm (cont d) Socket address Process-to-process delivery needs a socket address. Socket address is the combination of an IP address and a port number. The IPheader contains the IP address and the or UDP header contain the port number. Multiplexing/demultiplexing Multiplexing/Demultiplexing extends the network layer host-to-host delivery to a process-to-process delivery for the application programs. In fact, this concept is used whenever a single protocol at one layer is used by multiple protocols at the next higher layer Multiplexing At the sender: many several processes for only one transport layer protocol. This is a many-to-one relationship that requires multiplexing. Demultiplexing At the receiver: the message is delivered to the appropriate process. This is a one-to-one relationship that requires demultiplexing. Connectionless vs. connection-oriented service Connectionless service (like UDP) The packets are sent from one party to another with no need for connection establishment or connection release. The packet are not numbered. The may be delayed or lost or arrive out of sequence. There is no acknowledgment. Connection-oriented service (like and SCTP) A connection is first established between the sender and the receiver. After, data are transferred. At the end, the connection is released. 3 4 IS370- Mr Mourad Benchikh Page 2

Process-to-process delivery Reliable vs. unreliable Reliable transport layer protocol uses flow control and error control. Otherwise, it is an unreliable transport layer protocol. A reliable transport layer protocol means a slower and more complex service If an application layer program needs reliability, a reliable transport layer protocol will be used. If the application layer program doesn t need reliability (because it uses its own flow and error control) or if it needs such a service or the nature of the service doesn t need reliability, an unreliable transport layer protocol will be used. Internet transport layer protocols 1) UDP : connectionless and unreliable, 2) : connection-oriented and reliable, and 3) SCTP: connection-oriented and reliable. UDP UDP User Datagram Protocol- [RFC 768] A connectionless and unreliable protocol It adds to the IP services only the process-to-process delivery and a very limited error checking (without a retransmission mechanism).. It is a very simple protocol using a minimum overhead. Well-known UDP ports 5 6 IS370- Mr Mourad Benchikh Page 3

UDP User datagram An UDP packet is called a user datagram. The header hasa 8-byte fixed size defining four fields: Source port number: a 16-bit port number used by the process running on the source host. It is an ephemeral port number (in most cases) if the source host is a client. It is a well-known port number if the source is a server. Destination port number: same as above but for the destination host. Length: defines the total length of the user datagram, header plus data. Checksum: used to detect errors over the entire user datagram (header plus data). The checksum is optional and is also calculated over a few field of the IP header. UDP operations Connectionless service This means that each user datagram sent by UDP is an independent datagram => no relationship between the user datagrams even ifthey belong to the same destination program. The user datagrams are not numbered, there is no connection establishment and no connection release. This means that each user datagram can travel on a different path. => a process using UDP cannot send a stream of data. Each request should be small enough to fit into one user datagram. Only those processes sending short messages should use UDP. Flow and error control There is no flow control. The receiver may then overflow. There is noerror control except for the checksum. The sender couldn t know if the message has been lost or duplicated. The receiver silently discards a user datagram when an error is detected by the checksum. The process using UDP should provide the flow and error control if they are needed. No connection state (sequence and ACK numbers, send andreceive buffers?, etc) is needed. UDP UDP operations (cont d) Encapsulation and decapsulation To send messages from one process to another, the UDP encapsulates and decapsulates messages in IP datagram. Queuing In UDP, queues are associated with ports. Client site When a process starts, it requests a port number from the OS. Some implementations create both incoming and outgoing queue associated with each process. Other implementations create only an incoming queue. These queues are identified by the ephemeral port numbers assigned. These queues function as long as the process is running. They are destroyed when the process terminates. The client process can send messages to the outgoing queue by using the source port number specified in the request. UDP removes the messages one by onefrom the queue, adds the UDP header, and delivers them to IP. An outgoing queue can overflow. The OS asks then the client to wait before sending any more messages. When a message arrives for a client, UDP checks if an incoming queue has been created for the port number specified in the destination port. If so, UDP sends the received user datagram to the end of the queue. Otherwise, UDP discards the user datagram and asks ICMP to send a port unreachable message to the server. An incoming queue can overflow. UDP drops then the user datagram and asks for a port unreachable message to be sent to the server. Server site The mechanism of creating queues is different. Simplest form: The server asks for incoming and outgoing queues, using its well-known ports, when it starts. These queues remains open as long as the server is running. When a message arrives to the server, UDP checks to if an incoming queue has been created for the port number specified in the destination port number. If so, UDP places the user datagram at the end of the queue. Otherwise, UDP discards the user datagram and asks ICMP to send an unreachable port message to the client. An incoming queue can overflow. UDP drops the user datagram and asks that a port unreachable message to besent to the client. When a server wants to respond to a client, it sends messages to the outgoing queue using the source port number specified in the request. UDP encapsulates the user datagram get from the outgoing queue in IP packets. If the outgoing queue overflows, the OS asks the server to wait before sending any more messages. Some use of UDP It is suitable for a process that requires simple request-response communication with little concern on error and flow control. UDP is suitable for a process with an internal flow and error control like TFTP (Trivial FTP). UDP is a suitable process for multicasting. It is also used with SNMP and commonly with DNS also. It is also used with some route updating protocol such RIP 7 8 IS370- Mr Mourad Benchikh Page 4

Transmission Control Protocol- [RFC 793, 1122, 1323, 2118, 2528] It is a connection oriented protocol. It creates a virtual connection between two s to send data. It uses flow and error control, i.e. reliable protocol. services 1) Process-to-process communication Well-known ports 2) Stream delivery service allows the sending process to deliver data as a stream of bytes and the receiving process to obtain a stream of bytes. It is unlike UDP where a process sends messages with a predefined boundaries services (cont d) 3) Sending and receiving buffers. need buffers because the sending and the receiving processes may not operate at the same speed. There are two buffers: the sending and the receiving buffers one in each direction. One way of buffer implementation: a circular array of 1-byte location. At the sender site: the buffer has tree types of chambers: The white section contains empty chambers that can be filled by the sending process. The gray area holds bytes that have been sent but not yet acknowledged The colored area contains bytes to be sent by the sending. may be able to send only part of this colored section due to slowness of the receiving process or to network congestion. At the receiver site: the buffer is divided into two areas The white area contains empty chambers to be filled by bytes received from the network. The colored section contains received bytes that can be read by the receiving process. When a byte is read by the receiving process, the chamber is recycled and added to the pool of empty chambers. 9 4) Segments groups a number of bytes together into a packet called a segment. adds a header to each segment and delivers the segment to the IP layer. The segments have not necessarily the same size. MSS (Maximum Segment Size): the maximum amount of data in a segment (without header) Set by determining to the largest MTU that can be sent by thelocal host. 10 IS370- Mr Mourad Benchikh Page 5

services (cont d) 5) Full-duplex communication Data can flow in both directions at the same time. Each then has a sending and receiving buffer and segments move in both directions. There is no multicasting with. 6) Connection-oriented service When a process at site A wants to send and receive data from another process at B, the following occurs: The two s establish a connection between them. Data are exchanged in both directions. The connection is terminated. This is a virtual connection (not a physical). The segment is encapsulated in an IP datagram and can be sent out of order, or lost, or corrupted, and then resent. Each segment may use a different path to reach the destination. creates a stream-oriented environment in which it accepts the responsibility of delivering bytes in order to the other site. 7) Reliable service It uses acknowledgment to check the safety of data arrival. features : necessary to provide its services Numbering system keeps track of the segments being transmitted or received. There are two fields, the sequence number and the acknowledgement number, which refer to the byte number (and not to segment number) features (cont d) Byte number numbers all data bytes that are transmitted in a connection. Numbering is independent in each direction. When receives bytes from a process, it stores them in the sending buffer and number them. The numbering doesn t necessarily start from 0., in fact, generates a random number. This allows that a segment still present in the network from an earlier terminated connection is mistaken as a valid segment Sequence number After the bytes have been numbered, assigns a sequence number to each segment that is being sent. The sequence number of each segment is the number of the 1 st byte carried in that segment. When a segment carries a combination of data and control information (piggybacking), it uses a sequence number. If a segment doesn t carry data, it doesn t logically define a sequence number (except for connection establishment, termination, or abort to allow acknowledgement). If the randomly generated sequence number is x, the first data byte is x+1. The byte x is considered a phone byte used for the open connection control segment. Example A connection is transferring a file of 5000 bytes. The 1 st byte is numbered 10,001. what are the sequence numbers for each segment if data are sent in five segment each carrying 1000 bytes? 11 12 IS370- Mr Mourad Benchikh Page 6

features (cont d) Acknowledgment number Communication isfull-duplex. Each party numbers the bytes, usually with a different starting byte number. The sequence number in each direction shows the number of 1 st byte carried by the segment. Each party uses also an acknowledgment number to confirm the bytes it has received. The acknowledgment number defines the number of the next byte that the party expects to receive. The acknowledgment number is cumulative Ifa party uses 5643 asan acknowledgment number, this means it has received all bytes from the beginning up to 5642. This doesn t mean that the party has received 5642 bytes because the 1 st byte doesn t have to start from 0. Flow control The receiver of data controls the amount of data that are to be sent by the sender to prevent the receiver to be overwhelmed with data. The numbering system allows to use a byte-oriented flow control. Error control implements an error control to provide reliability. The error control is byte-oriented although the unit of data error detection is the segment. Congestion control The amount of data sent by a sender is not only controlled by the receiver (flow control), but also determined by the level of network congestion. Segment (cont d) The segment consists of 20-to-60-byte header (20-byte if there are no options) followed by data from the application program. Source port address anddestination port numbers to multiplex/demultiplex data aswith UDP. Sequence number : informs the destination which byte in this sequence (i.e. data stream) comprises the 1 st byte in the segment. During connection establishment, each party uses a random generator to create an initial sequence number (ISN), which is usually different in each direction. Acknowledgement number: defines the byte number that the receiver of the segment is expecting toreceive from the other party. Acknowledgement and data can be piggybacked together. Header length: indicated the number of 4-byte words in the header. Reserved: reserved for future use. Control: defines 6 different control bits or flags. 13 14 IS370- Mr Mourad Benchikh Page 7

Segment (cont d) Window size: defines the window size, in bytes, that the other party should maintain. This value is refereed as the receiving window (rwnd) and is determined by the receiver that the sender should consider. Checksum: calculated as with UDP but is mandatory included. Urgent pointer: valid only if the urgent flag is set. It defines the number to be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment. Options: there can be up to 40-byte of optional information in a header. An example of option is used when the sender and the receiver negotiate the MSS A connection A connection-oriented service establishes a virtual path between the source and the destination. All the segments belonging to the message are sent over this virtual path. Using a virtual pathway for the entire message facilitates the acknowledgment process as well the retransmission of damaged or lost frames. Because IP is a connectionless service, the connection is virtual, not physical. uses the IP services to delivers individual segments to the receiver but controls the connection itself. If a segment is lost or corrupted, it is retransmitted. Phases required in connection-oriented transmission 1) Connection establishment 2) Data transfer 3) Connection termination phase 1) Connection establishment : to allow full-duplex transmission of two s parties, each party must initialize communication and get approval from the other party before any data are transferred Connection establishment in is called three-way handshaking. Three-way handshaking The server program tells the that it is ready to accept a connection i.e. request for a passive open. The client program issues a request for an active open to tell its that it needs to be connected to that particular server. 15 16 IS370- Mr Mourad Benchikh Page 8

A connection Phase 1) Connection establishment Three-way handshaking (cont d) starts the three-way handshaking (to initialize the sequence numbers, the buffers, etc): The client sends the first segment, a SYN segment, in which only the SYN flag is set. - This segment is for synchronization of sequence numbers. It consumes one sequence number. The server sends the second segment, a SYN+ACK segment (with SYN and ACK flag bits set). - This segment is a SYN segment for communication in the other side. Itis also an acknowledgment for the SYN segment. This segment consumes one sequence number. The client sends the last segment. - This is an ACK segment. - It acknowledges the receipt of the second segment with the ACK flag and acknowledgement number field. - The sequence number is the same as the one in the SYN segment. No sequence number is consumed. connection Phase 2) Data transfer After a connection is established, bidirectional data transfer can take place. Both server and client can send data and acknowledgements. Data traveling in the same direction as an acknowledgement are carried on the same segment. The acknowledgment is piggybacked with the data. 17 Pushing data uses a buffer to store the stream of data coming from the sending application program. The receiving also buffers the data when they arrive and deliver them to the application program when the application program is ready. However, on occasion, an application that communicate interactively with another application doesn t need such a delay (i.e. put in buffer). The sending application program can request a push operation. => The sending must not wait for the window to be filled. It must create a segment and send it immediately. 18 IS370- Mr Mourad Benchikh Page 9

connection Phase 2) (cont d) Pushing data (cont d) The sending must also set the push bit (PSH) to let the receiving knows that the segment includes data that must be delivered to the receiving application program as soon as possible and not to wait for more data to come. Although the push operation can be requested by the application program, most current implementations ignore such a request. Urgent data On occasion, an application program needs to send urgent bytes. This means that it wants that a piece of data to be read out of order by the receiving application program. The sending creates a segment and inserts the urgent data at the beginning of the segment (the rest can contain normal data). The urgent pointer field in the header defines the end of the urgent data and the start of the normal data. The receiving, when it receives the segment with URG bit set, it extracts the urgent data from the segment, using the value of the urgent pointer, and delivers them out of order to the receiving application program. Phase 3) Connection termination Any of the two parties involved in the connection can close the connection although usually initiated by the client-. Most implementations allows two termination options: three-way handshaking and four-way handshaking with half-close. Three-way handshaking 1) In a normal situation, the client, after receiving a close command from the client process, sends the first segment, a FIN segment in which the FIN flag is set. This segment could contain the last chunk of data or be just a control segment in this case it consumes only one sequence number. connection (cont d) Phase 3) : connection termination (cont d) Three-way handshaking (cont d) 2) The server, after receiving the FIN segment, informs its process of the situation and sends the second segment, a FIN + ACK segment, to confirm the receipt of the FIN segment and to announce the closing of the connection in the other direction. This segment can contain the last chunk of data. If no, it consumes only one sequence number. 3) The client sends the last segment, an ACK segment, to confirm the receipt of the FIN segment from the server. This segment contains the acknowledgement number, which is 1 plus the sequence number received in the FIN segment from the server. This segment cannot carry data and consumes no sequence number. Four-way handshaking with Half-close One can stop sending data while still receiving data. The half-close is normally initiated by the client when the server needs all the data before processing can begin (ex. Sort). The client, after sending all the data, can close its outbound direction while its inbound direction must remain open. The server outbound direction must also remain open. The client half-closes the connection by sending a FIN segment. The server accepts it and sends the ACK segment (with no sequence number consumed). The data transfer from the client to the server stops (acknowledgements, however, can travel from the client to the server). The server can still send data. When the server has sent all the processed data, it sends a FIN segment, which is acknowledged by anack from the client (This ACK consumes no sequence number also) 19 20 IS370- Mr Mourad Benchikh Page 10

connection (cont d) Phase 3) connection termination Connection termination using the three-way handshaking Connection termination using four-way handshaking with half-close Flow control uses a sliding window to handle flow control. This sliding window is something between the Go-back-N and the selective repeat sliding window. s sliding window looks like the Go-back-N protocol because it doesn t use NACKs??; it looks like Selective-repeat protocol because the receiver holds the out-of-order segments until the missing one arrive. Differences between sliding window and the ones used at the data-link layer: sliding window is byte-oriented while the data-link layer is frame-oriented. s sliding window is of variable size while the data-link layer oneis of fixed size. The sliding window spans a portion of the buffer containing bytes received from the process. The bytes inside the window are the ones that can be in transit: they can be sent without worrying about acknowledgements. The window has two walls: one left and one right. The window is opened, closed, and shrunk These activities are in control of the receiver (and depend on the network congestion); the sender only obeys the command of the receiver in this matter. Opening a window: moves the right wall to the right. This allows more new bytes in the buffer that are eligible for sending. Closing the window means moving the left wall to the right. This means that some bytes have been acknowledged and the sender needs not worry about them anymore. Shrinking the window means moving the right window to the left. This is not allowed in some implementations. The size of the window at one end is determined by the lesser of two values: 1) the receiver window (rwnd) or the congestion window (cwnd). The receiver window is the one advertised by the opposite side in a segment containing acknowledgement. It is the number ofbytes the other end can accept before its buffer overflows and data are discarded. The congestion window is a value determined bythe network toavoid congestion. 21 22 IS370- Mr Mourad Benchikh Page 11

Flow control (cont d) Examples What is the value of the receiver window (rwnd) for host A if the receiver, host B, has a buffer size of 5000 bytes and 1000bytes of received and unprocessed data rwnd=5000-1000=4000. Host B can receive only 4000 bytes of data before overflowing its buffer. Host B advertises this value in its next segment to A. What is the size of the window for host A if the value if rwnd is 3000 bytes and the value of cwnd is 3500 bytes. The window size is the smallest of rwnd and cwnd = 3000 bytes. Sliding window example. The sender has sent bytes up to 202. Assume cwnd =20. The receiver has sent an acknowledgement number=200with an rwnd=9. The size of thesender window=min(rwnd, cwnd)=9 Bytes 200 to 202 are sent, butnotacknowledged. Bytes 203 to 208 can be sent without worrying about acknowledgement. Bytes 209 and above cannot be sent. Error control provides reliability using error control. Error control includes: detecting corrupted segments, out-of-order segments, and duplicated segments. Error control includes: correction of errors after detection. Error detection and correction is achieved by: checksum, acknowledgement, and time-out. Checksum Each segment includes a checksum field (mandatory) to check corruption. A corrupted segment is discarded by the destination and is considered as lost. Acknowledgement uses acknowledgement to confirm the receipt of data segment. Control segment that carries no data but consume a sequence number are also acknowledged. ACK segments are never acknowledged. Retransmission When a segment is corrupted, lost, or delayed, it is retransmitted. In modern implementations, a segment is retransmitted in two occasions: 1) when a retransmission timer expires, and 2) when the sender receives three duplicate ACKs. No retransmission for the segment that do not consume sequence numbers. In particular, no retransmission for segment carrying only ACK. Retransmission after RTO A recent implementation maintains one retransmission time-out (RTO) timer for all outstanding (sent but not acknowledged) segments i.e. RTO is attached to the oldest unacknowledged segment-. When the timer matures, the earliest outstanding segment is retransmitted. Notime-out timer is set for a segment that carries only an acknowledgement : no such segment is resent. RTO value is dynamic and is based on round-trip time (RTT) of segments. RTT: time needed for a segment to reach a destination and for an acknowledgement to be received. - EWMA is used to smooth the RTT fluctuations and to get an estimated RTT. RTT = Estimated_RTT + 4*DevRTT (DevRTT is a measurement of the variability of RTT). Itfollows a backoff strategy: each time retransmits, it sets RTT to double the previous value. 23 24 IS370- Mr Mourad Benchikh Page 12

Error control (cont d) Retransmission Retransmission after three duplicate ACK segments The previous method is sufficient if the RTO value is not very large. Sometimes, one segment is lost and the receiver receives so many out-of-order segments that they cannot be saved (limited memory size). Most implementation today follow the three-duplicate-acks rule and retransmit the missing segment immediately. This feature is referred as fast retransmission. Out-of-order segments When a segment is delayed, lost, or discarded, the segments following that segment arrive out of order. Originally, was designed todiscard all out-of-order segments. This is result in the retransmission of the missing segment and the following segments. Most implementations today do not discard the out-of-order segments. They store them temporarily and flag them as out-of-order segments until the missing segment arrives. The out-of-order segments are not delivered to the process which guarantees that data are delivered to the process in order. Error control Some scenarios Normal operation 25 Lost segment Fast retransmission 26 IS370- Mr Mourad Benchikh Page 13