Computer Network Unit 4 Notes, Study notes of Computer Networks

Computer Network - Unit 4 notes

Typology: Study notes

2022/2023

Available from 12/03/2023

tamil-fan
tamil-fan 🇮🇳

1 document

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CN :Unit IV - Transport Layer- Chennai Institute of Technology
Page 1
UNIT IV
TRANSPORT LAYER
Introduction – Transport Layer Protocols – Services – Port Numbers – User Datagram Protocol –
Transmission Control Protocol – SCTP.
4.1 Introduction of Transport Layer
A transport layer is responsibility for source to destination or end to end delivery of
entire message.
Transport layer functions
1. This layer breaks messages into packets.
2. It performs error recovery if the lower layer are not adequately error free.
3. Function of flow control if not done adequately at the network layer.
4. Functions of multiplexing and demultiplexing sessions together.
5. This layer can be responsible for setting up and releasing connections across the network.
4.2 The Transport Services
Thetransport entity that provides services to transport service users, whichmight be an
application process.
The hardware and software within the transport layer that does the work is called the
transport entity. The following categories of service are useful for describing the
transportservice.
1. Type of service
2. Quality of service
3. Data transfer
4. User interface
5. Connection management
6. Expedited delivery
7. Status reporting
8. Security
1. Type of service
It provides two types of services connection-oriented and connectionless or datagram
service.
2. Quality of service
The transport protocol entity should allow the transport service user to specify the quality
of transmission service to be provided.
Following are the transport layer quality of service parameters.
a) Error and loss levels.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Computer Network Unit 4 Notes and more Study notes Computer Networks in PDF only on Docsity!

CN :Unit IV - Transport Layer- Chennai Institute of Technology

UNIT IV

TRANSPORT LAYER

Introduction – Transport Layer Protocols – Services – Port Numbers – User Datagram Protocol – Transmission Control Protocol – SCTP.

4.1 Introduction of Transport Layer

  • A transport layer is responsibility for source to destination or end to end delivery of entire message.
  • Transport layer functions
  1. This layer breaks messages into packets.
  2. It performs error recovery if the lower layer are not adequately error free.
  3. Function of flow control if not done adequately at the network layer.
  4. Functions of multiplexing and demultiplexing sessions together.
  5. This layer can be responsible for setting up and releasing connections across the network.

4.2 The Transport Services

  • Thetransport entity that provides services to transport service users, whichmight be an application process.
  • The hardware and software within the transport layer that does the work is called the transport entity. The following categories of service are useful for describing the transportservice.
    1. Type of service
    2. Quality of service
    3. Data transfer
    4. User interface
    5. Connection management
    6. Expedited delivery
    7. Status reporting
    8. Security 1. Type of service
  • It provides two types of services connection-oriented and connectionless or datagram service. 2. Quality of service
  • The transport protocol entity should allow the transport service user to specify the quality of transmission service to be provided.
  • Following are the transport layer quality of service parameters. a) Error and loss levels.

CN :Unit IV - Transport Layer- Chennai Institute of Technology b) Desired average and maximum delay. c) Throughput. d) Priority level. e) Resilience.

3. Data transfer: It transfers data between two transport entities. 4. User Interface: There is not clear mechanism of the user interface to the transport protocol should be standardized. 5. Connection management : If connection-oriented service is provided, the transport entity is responsible for establishing and terminating connections. 6. Status reporting : It gives the following information. a) Addresses. b) Performance characteristics of a connection. c) Class of protocol in use. d) Current timer values. 7. Security : The transport entity may provide a variety of security services.

4.3 USER DATAGRAM PROTOCOL (UDP) :

UDP is a simple, datagram-oriented, transport layer protocol. UDP is connectionless protocol provides no reliability or flow control mechanisms. It also has no error recovery procedures. The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It performs very limited error checking.

1. User Datagram UDP packets, called user datagrams, have a fixed-size header of 8 bytes. Figure 4.9 shows the format of a user datagram. The fields are as follows: Source port number. This is the port number used by the process running on the sourcehost. It is 16 bits long, which means that the port number can range from 0 to 65,535. Destination port number. This is the port number used by the process running on thedestination host. It is also 16 bits long.

CN :Unit IV - Transport Layer- Chennai Institute of Technology Connectionless Services UDP provides a connectionless service. This means that each user datagram sent by UDP is an independent datagram. There is no relationship between the different user datagrams even if they are coming from the same source process and going to the same destination program. Flow and Error Control UDP is a very simple, unreliable transport protocol. There is no flow control and hence no window mechanism. The receiver may overflow with incoming messages. There is no error control mechanism in UDP except for the checksum. Encapsulation and Decapsulation To send a message from one process to another, the UDP protocol encapsulates and decapsulates messages in an IP datagram. Queuing In UDP, queues are associated with ports. (Figure 4.12). At the client site, when a process starts, it requests a port number from the operating system. Some implementations create both an incoming and an outgoing queue associated with each process. Other implementations create only an incoming queue associated with each process.

5. Use of UDP The following lists some uses of the UDP protocol: UDP is suitable for a process that requires simple request-response communication with little concern for flow and error control. UDP is suitable for a process with internal flow and error control mechanisms. UDP is a suitable transport protocol for multicasting. UDP is used for some route updating protocols such as Routing Information Protocol (RIP).

4.4 TCP

TCP is a process-to-process (program-to-program) protocol. TCP is called a connection- oriented, reliable transport protocol. TCP uses flow and error control mechanisms at the transport level.

  1. TCP Services

CN :Unit IV - Transport Layer- Chennai Institute of Technology The services offered by TCP to the processes at the application layer. Process-to-Process Communication TCP provides process-to-process communication using port numbers.

  1. Stream Delivery Service TCP is a stream-oriented protocol. TCP allows the sending process to deliver data as a stream of bytes and allows the receiving process to obtain data as a stream of bytes. TCP creates an environment in which the two processes seem to be connected by an imaginary "tube" that carries their data across the Internet. Sending and Receiving Buffers: Because the sending and the receiving processes may not write or read data at the same speed, TCP needs buffers for storage. There are two buffers, the sending buffer and the receiving buffer, one for each direction. Segments At the transport Layer, TCP groups a number of bytes together into a packet called a segment.
  2. Full-Duplex Communication TCP offers full-duplex service, in which 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.
    1. Connection-Oriented Service TCP is a connection-oriented protocol. When a process at site A wants to send and receive data from another process at site B, the following occurs:
  3. The two TCPs establish a connection between them.
  4. Data are exchanged in both directions.
  5. The connection is terminated. Reliable Service TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and sound arrival of data.
    1. TCP Features TCP has several features. Numbering System

CN :Unit IV - Transport Layer- Chennai Institute of Technology The segment consists of a 20- to 60-byte header. Source port address. This is a 16-bit field that defines the port number of the applicationprogram. Destination port address. This is a 16-bit field that defines the port number of theapplication program in the host that is receiving the segment. Sequence number. This 32-bit field defines the number assigned to the first byte of datacontained in this segment. Acknowledgment number. This 32-bit field defines the byte number that the receiver ofthe segment is expecting to receive from the other party. Header length. This 4-bit field indicates the number of 4-byte words in the TCP header.The length of the header can be between 20 and 60 bytes. Therefore, the value of this field can be between 5 (5 x 4 =20) and 15 (15 x 4 =60). Reserved. This is a 6-bit field reserved for future use. Control. This field defines 6 different control bits or flags as shown in Figure 4.17.One or more of these bits can be set at a time. These bits enable flow control, connection establishment and termination, connection abortion, and the mode of data transfer in TCP. A brief description of each bit is shown in Table 4. Window size. This field defines the size of the window, in bytes, that the other partymust maintain. Checksum. This 16-bit field contains the checksum. Urgent pointer. This l6-bit field, which is valid, only if the urgent flag is set, is usedwhen the segment contains urgent data.

CN :Unit IV - Transport Layer- Chennai Institute of Technology Options. There can be up to 40 bytes of optional information in the TCP header. A TCP Connection TCP is connection-oriented. A connection-oriented transport protocol establishes a virtual path between the source and destination. All the segments belonging to a message are then sent over this virtual path. a. Connection Establishment TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they are able to send segments to each other simultaneously. Three-Way Handshaking: The connection establishment in TCP is called three way handshaking. Tthe three-way handshaking process as shown in Figure 4.18.

  1. 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. When the data transfer start, the sequence number is incremented by 1.
  2. The server sends the second segment, a SYN +ACK segment, with 2 flag bits set: SYN and ACK.
  3. The client sends the third segment. This is just an ACK segment. It acknowledges the receipt of the second segment with the ACK flag and acknowledgment number field. b. Data Transfer After connection is established, bidirectional data transfer can take place. The client and server can both send data and acknowledgments. Figure 4.19 shows an example. In this example, after connection is established (not shown in the figure), the client sends 2000 bytes of data in two segments. The server then sends 2000 bytes in one segment.

CN :Unit IV - Transport Layer- Chennai Institute of The FIN segment consumes one sequence number if it does not carry data.

  1. 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 from the client and at the same time to announce the closing of the connection in the other direction. The FIN +ACK segment consumes one sequence number if it does not carry data.
  2. 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 acknowledgment number, which is 1 plus the sequence number received in the FIN segment from the server. Figure 4.20 : Three-way handshaking for connection termination Half-Close In TCP, one end can stop sending data while still receiving data. This is called a half-close. Figure 4.21 shows an example of a half-close. The client half-closes the connection by sending a FIN segment. The server accepts the half-close by sending the ACK segment. The data transfer from the client to the server stops. The server, however, 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.

CN :Unit IV - Transport Layer- Chennai Institute of

10. Flow Control TCP uses a sliding window to handle flow control. The sliding window protocol used by TCP, however, is something between the Go-Back-N and Selective Repeat sliding window. The size of the window at one end is determined by the lesser of two values: receiver window (rwnd) or congestion window (cwnd). Some points about TCP sliding windows:  The size of the window is the lesser of rwnd and cwnd.  The source does not have to send a full window's worth of data.  The window can be opened or closed by the receiver, but should not be shrunk.  The destination can send an acknowledgment at any time as long as it does not result in a shrinking window.  The receiver can temporarily shut down the window; the sender, however, can always send a segment of 1 byte after the window is shut down. 11. Error Control TCP is a reliable transport layer protocol. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the application program on the other end in order, without error, and without any part lost or duplicated. a. Checksum Each segment includes a checksum field which is used to check for a corrupted segment. If the segment is corrupted, it is discarded by the destination TCP and is considered as lost. TCP uses a 16-bit checksum that is mandatory in every segment. b. Acknowledgment TCP uses acknowledgments to confirm the receipt of data segments. c. Retransmission The heart of the error control mechanism is the retransmission of segments. When a segment is corrupted, lost, or delayed, it is retransmitted.. i. Retransmission After RTO A recent implementation of TCP maintains one retransmission time-out (RTO) timer for all outstanding (sent, but not acknowledged) segments.

CN :Unit IV - Transport Layer- Chennai Institute of c. Fast Retransmission In this scenario, we want to show the idea of fast retransmission. Our scenario is the same as the second except that the RTO has a higher value (see Figure 4.25). Example 4.5.1 With TCP's slow start and AIMD for congestion control, show how the windowsize will vary for a transmission where every 5th packet is lost. Assume an advertised window size of 50 MSS. Solution: Since Slow Start is used, window size is increased by the number ofsegments successfully sent. This happens until either threshold, value is reached or time out occurs. In both of the above situations AIMD is used to avoid congestion. If threshold is reached, window size will be increased linearly. If there is timeout, window size will be reduced to half. Assuming the window size at the start of the slow start phase is 2 MSS and the threshold at the start of the first transmission is 8 MSS.

CN :Unit IV - Transport Layer- Chennai Institute of Window size for 1st transmission = 2 MSS Window size for 2nd transmission = 4 MSS Window size for 3rd transmission = 8 MSS threshold reached, increase linearly (according to AIMD) Window size for 4th transmission = 9 MSS Window size for 5th transmission = 10 MSS time out occurs, resend 5thwith window size starts with as slow start. Window size for 6 th transmission = 2 MSS Window size for 7 th transmission = 4 MSS threshold reached, now increase linearly (according to AIMD) Additive Increase: 5 MSS (since 8 MSS isn't permissible anymore) Window size for 8th transmission = 5 MSS Window size for 9th transmission = 6 MSS Window size for 10th transmission = 7 MSS This shows that window size is variable and time out occurs during the fifth transmission. Example 4.5.2 Suppose you are hired to design a reliable byte-stream protocol that uses a sliding window (like TCP). This protocol will run over a 50-Mbps network, the RTT of the network is 80ms and the maximum segment lifetime is 60 seconds. How many bits would you include in the Advertised Window and Sequence Numfields of your protocol header? Solution

( 50 10^3 )

The window size (in bytes) must be RTT  Bandwidth = 8 (0.08) = 500 bytes We need therefore, 12 bits for the advertized window (allows a maximum windowsize of 33554431 bytes)

4.6 Adaptive Retransmission

  • TCPguarantees the reliable delivery of data, it retransmits each segment if an ACKis not received in a certain period of time. TCP sets this timeout as a function of the RTT it expects between the two ends of the connection.
  • TCP uses an adaptive retransmission mechanism.
  • Every time TCP sends a data segment, it records the time. When an ACK for that segment arrives, TCP reads the time again and then takes the difference between these two times as a sample RTT.
  • TCP then computes an estimate RTT as a weighted average between the previous estimate and this new sample. Estimated RTT = α Estimated RTT + (1 - α)  Sample RTT

CN :Unit IV - Transport Layer- Chennai Institute of

  • This algorithm is used by any end to end protocol.
  • In this algorithm, the sender measures a new sample RTT as before. It then foldsthis new sample into the timeout calculation as follows : Difference = Sample RTT - Estimated RTT Estimated RTT = Estimated RTT + ( Difference) Deviation = Deviation + (| Difference | - Deviation) where is fraction between 0 and 1.
  • TCP then computes the timeout value as a function and both Estimated RTT and deviation as follows : Timeout = μ Estimated RTT +  Deviation

4.7 Congestion Control

Congestion control refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened. In general, we can divide congestion control mechanisms into two broad categories: open-loop congestion control (prevention) and closed-loop congestion control (removal) as shown in Figure 4.27.

  1. Open-Loop Congestion Control In open-loop congestion control, policies are applied to prevent congestion before it happens. In these mechanisms, congestion control is handled by either the source or the destination. a. Retransmission Policy Retransmission is sometimes unavoidable. If the sender feels that a sent packet is lost or corrupted, the packet needs to be retransmitted. Retransmission in general may increase congestion in the network. However, a good retransmission policy can prevent congestion b. Window Policy The type of window at the sender may also affect congestion. The Selective Repeat window is better than the Go-Back-N window for congestion control. In the Go-Back-N window, when the timer for a packet times out, several packets may be resent.

CN :Unit IV - Transport Layer- Chennai Institute of c. Acknowledgment Policy The acknowledgment policy imposed by the receiver may also affect congestion. If the receiver does not acknowledge every packet it receives, it may slow down the sender and help prevent congestion. d. Discarding Policy A good discarding policy by the routers may prevent congestion and at the same time may not harm the integrity of the transmission. For example, in audio transmission, if the policy is to discard less sensitive packets when congestion is likely to happen, the quality of sound is still preserved and congestion is prevented or alleviated. e. Admission Policy An admission policy, which is a quality-of-service mechanism, can also prevent congestion in virtual-circuit networks. Switches in a flow, first check the resource requirement of a flow before admitting it to the network.

  1. Closed-Loop Congestion Control Closed-loop congestion control mechanisms try to alleviate congestion after it happens. Several mechanisms have been used by different protocols. a. Backpressure Backpressure is a node-to-node congestion control that starts with a node and propagates, in the opposite direction of data flow, to the source. Figure 4.28 shows the idea of backpressure. Node III in the figure has more input data than it can handle. It drops some packets in its input buffer and informs node II to slow down. Node II, in turn, may be congested because it is slowing down the output flow of data. If node II is congested, it informs node I to slow down, which in turn may create congestion. If so, node I inform the source of data to slow down. This, in time, alleviates the congestion. Note that the pressure on node III is moved backward to the source to remove the congestion. b. Choke Packet A choke packet is a packet sent by a node to the source to inform it of congestion. Note the difference between the backpressure and choke packet methods. In backpressure, the warning is from one node to its upstream node, although the warning may eventually reach the source station. In the choke packet method, the warning is from the router, which has encountered

CN :Unit IV - Transport Layer- Chennai Institute of TempP We know have Pcount = (1^ ^ count^ ^ TempP) = 1/(100 – count)

  • For count = 1 this is 1/99.
  • For count = 50 it is 1/50.

4.9 Quality of services:

1  count  0.01 =^

100  count

4.10 Techniques to Improve QoS

Some techniques that can be used to improve the quality of service. The four common methods: scheduling, traffic shaping, admission control, and resource reservation. a. Scheduling Packets from different flows arrive at a switch or router for processing. A good scheduling technique treats the different flows in a fair and appropriate manner. Several scheduling techniques are designed to improve the quality of service. We discuss three of them here: FIFO queuing, priority queuing, and weighted fair queuing. i. FIFO Queuing In first-in, first-out (FIFO) queuing, packets wait in a buffer (queue) until the node (router or switch) is ready to process them. If the average arrival rate is higher than the average processing rate, the queue will fill up and new packets will be discarded. A FIFO queue is familiar to those who have had to wait for a bus at a bus stop. ii. Priority Queuing In priority queuing, packets are first assigned to a priority class. Each priority class has its own queue. The packets in the highest-priority queue are processed first. Packets in the lowest- priority queue are processed last. Figure 4.32 shows priority queuing with two priority levels (for simplicity).

CN :Unit IV - Transport Layer- Chennai Institute of iii. Weighted Fair Queuing A better scheduling method is weighted fair queuing. In this technique, the packets are still assigned to different classes and admitted to different queues. The queues, however, are weighted based on the priority of the queues; higher priority means a higher weight. The system processes packets in each queue in a round-robin fashion with the number of packets selected from each queue based on the corresponding weight. For example, if the weights are 3, 2, and 1, three packets are processed from the first queue, two from the second queue, and one from the third queue. Figure 4.33 shows the technique with three classes. b. Traffic Shaping Traffic shaping is a mechanism to control the amount and the rate of the traffic sent to the network. Two techniques can shape traffic: leaky bucket and token bucket i. Leaky Bucket If a bucket has a small hole at the bottom, the water leaks from the bucket at a constant rate as long as there is water in the bucket. The rate at which the water leaks does not depend on the rate at which the water is input to the bucket unless the bucket is empty. The input rate can vary, but the output rate remains constant. Similarly, in networking, a technique called leaky bucket can smooth out bursty traffic. Bursty chunks are stored in the bucket and sent out at an average rate. Figure 4.34 shows a leaky bucket and its effects.