Top Banner
1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh
26

1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

Jan 01, 2016

Download

Documents

Lizbeth Phelps
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

1

IS370 Data Communications

and Computer Networks

Chapter 5 : Transport Layer

Instructor : Mr Mourad Benchikh

Page 2: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

2

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 to another process on another computer.

• => includes a type of address in the transport layer header called :– OSI: service-point address.– TCP/IP: port address.

• A transport layer can be either connectionless or connection-oriented.

• 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 , TCP, and SCTP.

Page 3: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

3

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) well-

known 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.

Page 4: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

4

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 IP header contains the IP address and the TCP 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– Connection 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 TCP and SCTP)• A connection is first established between the sender and the receiver. After, data are transferred. At the end, the

connection is released.

Page 5: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

5

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) TCP: connection-oriented and reliable, and 3) SCTP: connection-oriented and reliable.

Page 6: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

6

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

Page 7: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

7

UDP• User datagram– An UDP packet is called a user datagram. The header has a 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 if they 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 no error 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 and receive buffers?, etc) is needed.

Page 8: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

8

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 one from 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 be sent 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

Page 9: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

9

TCP• TCP –Transmission Control Protocol- [RFC 793, 1122, 1323, 2118, 2528]• It is a connection oriented protocol.

– It creates a virtual connection between two TCPs to send data.• It uses flow and error control, i.e. reliable protocol.• TCP services

– 1) Process-to-process communication• Well-known TCP ports

– 2) Stream delivery service• TCP 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

Page 10: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

10

TCP• TCP services (cont’d)

– 3) Sending and receiving buffers.• TCP 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 TCP. TCP 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 .

– 4) Segments• TCP groups a number of bytes together into a packet called a segment.• TCP 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 the local host.

Page 11: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

11

TCP• TCP services (cont’d)–5) Full-duplex communication

• Data can flow in both directions at the same time.• Each TCP then has a sending and receiving buffer and segments move in both directions.• There is no multicasting with TCP.

–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 TCPs establish a connection between them.– Data are exchanged in both directions.– The connection is terminated.

• This is a virtual connection (not a physical). • The TCP 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.• TCP 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.• TCP features : necessary to provide its services

– Numbering system• TCP 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)

Page 12: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

12

TCP• TCP features (cont’d)– Byte number

• TCP numbers all data bytes that are transmitted in a connection.• Numbering is independent in each direction.• When TCP receives bytes from a process, it stores them in the sending buffer and number them.• The numbering doesn’t necessarily start from 0. TCP, 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, TCP assigns a sequence number to each segment that is being

sent.• The sequence number of each segment is the number of the 1st 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 TCP connection is transferring a file of 5000 bytes. The 1st byte is numbered 10,001. what are the

sequence numbers for each segment if data are sent in five segment each carrying 1000 bytes?

Page 13: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

13

TCP• TCP features (cont’d)

– Acknowledgment number• TCP Communication is full-duplex. • Each party numbers the bytes, usually with a different starting byte number.• The sequence number in each direction shows the number of 1st 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– If a party uses 5643 as an 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 TCP to use a byte-oriented flow control.

– Error control• TCP 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.

Page 14: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

14

TCP• 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 and destination port numbers to multiplex/demultiplex data as with UDP.

• Sequence number : informs the destination which byte in this sequence (i.e. data stream) comprises the 1st 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 to receive from the other party. Acknowledgement and data can be piggybacked together.

• Header length: indicated the number of 4-byte words in the TCP header.

• Reserved: reserved for future use.

• Control: defines 6 different control bits or flags.

Page 15: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

15

TCP

• 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 TCP header.

• An example of option is used when the sender and the receiver negotiate the MSS

Page 16: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

16

TCP•A TCP 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 TCP connection is virtual, not physical.– TCP 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 TCPs parties, each party must initialize communication and get approval from the other party before any data are transferred• Connection establishment in TCP is called three-way handshaking.• Three-way handshaking

• The server program tells the TCP 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 TCP that it needs to be connected to that particular server.

Page 17: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

17

TCP•A TCP connection–Phase 1) Connection establishment

• Three-way handshaking (cont’d)–TCP 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. It is 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.

Page 18: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

18

TCP• TCP 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.

– Pushing data• TCP uses a buffer to store the stream of data coming from the sending application program. • The receiving TCP 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 TCP must not wait for the window to be filled. It must create a segment and send it

immediately.

Page 19: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

19

TCP•TCP connection– Phase 2) (cont’d)

–Pushing data (cont’d)• The sending TCP must also set the push bit (PSH) to let the receiving TCP 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 TCP 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 TCP, 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 TCP, 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.

Page 20: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

20

TCP• TCP connection (cont’d)

• Phase 3) : connection termination (cont’d)• Three-way handshaking (cont’d)

• 2) The server TCP, 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 TCP sends the last segment, an ACK segment, to confirm the receipt of the FIN segment from the TCP 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 an ACK from the client (This ACK consumes no sequence number also)

Page 21: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

21

TCP• TCP connection (cont’d)– Phase 3) connection termination

• Connection termination using the three-way handshaking

• Connection termination using four-way handshaking with half-close

Page 22: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

22

TCP• Flow control

–TCP uses a sliding window to handle flow control.

– This sliding window is something between the Go-back-N and the selective repeat sliding window.• TCP’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 TCP sliding window and the ones used at the data-link layer: – TCP sliding window is byte-oriented while the data-link layer is frame-oriented.

– TCP’s sliding window is of variable size while the data-link layer one is 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 send in a segment containing acknowledgement. It is the number of bytes the other end can accept before its buffer overflows and data are discarded.

• The congestion window is a value determined by the network to avoid congestion.

Page 23: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

23

TCP• 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

1000 bytes 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=200 with an rwnd=9.– The size of the sender window=min(rwnd, cwnd)=9– Bytes 200 to 202 are sent, but not acknowledged. Bytes 203 to 208 can be sent without worrying about acknowledgement.– Bytes 209 and above cannot be sent.

Page 24: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

24

TCP• Error control– TCP 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 TCP destination and is considered as lost.

– Acknowledgement• TCP 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.– No time-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).• It follows a backoff strategy: each time TCP retransmits, it sets RTT to double the previous value.

Page 25: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

25

TCP• 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, TCP was designed to discard 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.

Page 26: 1 IS370 Data Communications and Computer Networks Chapter 5 : Transport Layer Instructor : Mr Mourad Benchikh.

26

TCP• Error control– Some scenarios

• Normal operation

• Lost segment

• Fast retransmission