OVERVIEW Transport Layer Service Connection Establishment Flow Control Con g estion Cont r o l a nd A vo id a nce Transmission Control Protocol User Datagram Protocol Transport for Real Time Applications (RTP).
The Transport layer is responsible for process- to-process or end-end delivery of the entire message. The transport layer ensures that the whole message arrives intact and overseeing both
Service point addressing(Process-Process delivery) Segmentation and reassembly Connection control Flow control(QoS) – MUX & Demux Error control – error checking and recovery Congestion control
– T r ans p o r t L a y er P r o vides : Efficient Reliable and Cost-effective services Another TWO Kinds of Services are : Con ne cti o n ori e n t e d - T CP Connectionless - UDP
Sim p le S e r vice : P rimiti v es Simple primitives: Connect Send Receive Disconnect How to handle incoming connection request in server process? Wait for connection request from client! listen
Berkeley service : Primitives
Connection Establishment Once a connection is established, both client and server may exch a nge data using several system calls. A connection is typically used for client-server interaction. A server advertizes a particular server at a well- known address and clients establish connections to that socket to avail of the offered service. Thus the connection estblishment procedure is asymmetric.
– Problems to solve Selec t i o n o f t h e i ni t i al seq u ence number for a new connection. W r ap a r oun d o f seq u ence n u mb e r s for an active connection. It Handle host crashes.
Releasing a connection Asymmetric Connection broken when one party hangs up Abrupt! may result in data loss Symmetric Both parties should agree to release connection How to reach agreement? Two-army problem Solution: three-way-handshake Pragmatic approach Connection = 2 unidirectional connections Sender can close unidirectional connection
Flow Control I t is a set of procedures to tell the sender how much data it can transmit before it must wait for an ac kno wle dg e m e n t f r o m t h e r ecei v e r . T w o c a t e gor ie s o f f lo w c o n t r o l : Stop-and-wait S e n d o n e fr a m e a t a t i m e . S l i d i n g wi n d o w S e n d se v e r a l fr a m e s a t a t i m e .
Stop-and-wait S en d e r s en d s o n e f ra m e a n d w ait s f o r a n acknowledgement before sending the next frame.
Stop-and-wait Advantages: Simplicity. E a c h f ra m e i s chec k e d a n d a ckn o w l e d g e d b e f o r e t h e ne x t f ra m e i s s en t . Disadvantages: Slow. Can add significantly to the total transmission time i f th e d i s tan c e b et w ee n d e v i c e s i s l o n g . Inefficiency Eac h f r a m e i s a l on e o n th e l ine .
SlidingWindow S e n d e r ca n s en d s e v e ra l f r a m e s b e f o r e nee d i n g a n ac k n o w l e d g e m e n t . Advantages: The link can carry several frames at once. Its capacity can be used efficiently.
Congestion Control and Avoidance Con g e s ti o n C o n t r o l i s c o nc e r ned wi t h e f f ic i e n t ly us i n g a n e t w or k a t h i gh l oa d . t e c hn i qu es c an b e em p l o y e d . These Several i n clude: – Warning bit C hok e p ac k e t s L o ad s h e dd in g Ra n do m E ar l y D is card Traffic shaping Detection Avoidance
Principles of Congestion Control Congestion: informally: “too many sources sending too much data too fast for network to handle” d i f f e r e n t f r o m f l o w c o n t r ol! = end-to-end issue! lost packets (buffer overflow at routers) long delays (queue-ing in router buffers)
Causes of Congestion T w o sen d e r s , T w o r e c ei v e r s One router, Infinite buffers No retransmission
Approaches towards congestion control End-to-End congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP Network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion ( ATM ) explicit rate sender should send it. Two broad approaches towards congestion control:
Congestion Detection and Control The following 3 Methods are used to Detect & Control the Congestions : Warning bit Choke packets Load shedding
Warning Bit 6 A special bit in the packet header is set by the router to warn the source when congestion is detected. The bit is copied and piggy-backed on the ACK and sent to the sender. The sender monitors the number of ACK packets it receives with the warning bit set and adjusts its transmission rate accordingly.
Choke Packets A more direct way of telling the source to slow down . A choke packet is a control packet generated at a congested node and transmitted to restrict traffic flow. The source, on receiving the choke packet m u s t r e du ce its tr a n s m is s i o n r a te by a ce r tain percentage. An example of a choke packet is the ICMP Source Quench Packet. 3 4 7
Load Shedding 3 4 8 When buffers become full, routers simply discard packets. Which packet is chosen to be the victim depends on the application and on the error strategy used in th e d a t a link l a y e r . For a file transfer, for, e.g. cannot discard older packets since this will cause a gap in the received data. For real-time voice or video it is probably better t o th r o w a w ay old d a t a a n d k eep n ew p ac k e t s . G et th e a ppl i ca tio n t o m ark p ac k e t s w ith dis card priority.
C o n g esti o n A vo i da nce Th e f o l l o win g 2 M e t h ods a r e u sed t o A v o i d t h e Congestions : Random Early Discard Traffic Shaping
Random Early Discard (RED) This is a proactive approach in which the router discards one or more packets before the buffer becomes completely full. 3 5 Each time a packet algorithm computes length, avg . a r r i v e s , t h e the average RED queue If avg is lower than some lower threshold, congestion is assumed to be minimal or non- existent and the packet is queued.
RED, cont. If avg is greater than some upper threshold, congestion is assumed to be serious and the packet is discarded. If avg is between the two thresholds, this might indicate the onset of congestion. The probability of congestion is then calculated. 3 5 1
Traffic Shaping Another method of congestion Avoidance is to “shape” the traffic before it enters the network. Traffic shaping controls the rate at which packets are sent (not just how many). Used in ATM and Integrated Services networks. At connection set-up time, the sender and carrier negotiate a traffic pattern (shape). Two traffic shaping algorithms are: L ea k y Buck et T ok en Bu c k et
The Leaky Bucket Algorithm The Leaky Bucket Algorithm used to control rate in a network. It is implemented as a single- server queue with constant service time. If the bucket (buffer) overflows then packets are discarded.
The Leaky Bucket Algorithm (a) A leaky bucket with water. (b) a leaky bucket with packets.
Token Bucket Algorithm In contrast to the LB, the Token Bucket Algorithm, allows the output rate to vary, depending on the size of the burst. In th e T B a l g o r i th m , th e bu c k et hold s tok e n s . T o t r a n s m i t a packet, the host must capture and destroy one token. T ok e n s are g e n er a t e d b y a c lo ck at t h e rate o f on e tok en every sec. Idle hosts can capture and save up tokens (up to the max. size of the bucket) in order to sendlarger bursts later.
The Token B 5- u 34 cket Algorithm (a) Before. (b) After.
Transmission Control Protocol TCP is r ece i v er relia bl e pr o t oco l . always sends e i t her p o si t i v e T h at is , t h e or ne g a t i v e a ck n o w l e dg e m en t a b o u t t h e d ata packet to the sender I t e ns u r e s t h e d a t a p ac k e t i s r eac h e d t he destination or it needs to resend it. TCP provides end-to-end communication. TCP provides full duplex server T C P I P I n t e r n e t w o r k ByteStream ByteStream T C P
Well-known ports used by TCP
Figure : TCP segment format
TCP Header The length of TCP header is minimum 20 bytes long and maximum 60 bytes. Source Port (16-bits) - It identifies source port of the application process on the sending device. Destination Port (16-bits) - It identifies destination port of the application process on the receiving device. Sequence Number (32-bits) - Sequence number of data bytes of a segment in a session.
Acknowledgement Number (32- bits) - When ACK flag is set, this number contains the next sequence number of the data byte expected and works as acknowledgement of the previous data received. Data Offset (4-bits) - This field implies both, the size of TCP header (32-bit words) and the offset of data in current packet in the whole TCP segment. Reserved (3-bits) - Reserved for future use and all are set zero by default.
Flags (1-bit each) NS - Nonce Sum bit is used by Explicit Congestion Notification signaling process. CWR - When a host receives packet with ECE bit set, it sets Congestion Windows Reduced to acknowledge that ECE received. E C E - If SYN bit is clear to 0, then ECE means that the IP packet has its CE (congestion experience) bit set.
URG - It indicates that Urgent Pointer field has significant data and should be processed. ACK - It indicates that Acknowledgement field has significance. If ACK is cleared to 0, it indicates that packet does not contain any acknowledgement. P U SH - When set, it is a request to the receiving station to PUSH data (as soon as it comes) to the receiving application without buffering it.
RS T - R ese t f l ag has t he f o l l o wi n g features: It is used to refuse an incoming connection. It is used to reject a segment. It is used to restart a connection. S Y N - Th i s f l ag i s u s e d t o s e t u p a connection between hosts. FIN - This flag is used to release a connection and no more data is exchanged thereafter. Because packets with SYN and FIN flags have sequence numbers, they are processed in correct order.
Windows Size - This field is used for flow control between two stations and indicates the amount of buffer (in bytes) the receiver has allocated for a segment, i.e. how much data is the receiver expecting. Checksum - This field contains the checksum of Header, Data and Pseudo Headers. Urgent Pointer - It points to the urgent data byte if URG flag is set to 1.
Options - It facilitates additional options re g u l a r wh i c h a r e no t c o v e r e d b y t he header. Opti o n f i e l d i s a l w a y s descr i bed in 3 2 - bit words. If this field contains data less than 32-bit, padding is used to cover the remaining bits to reach 32-bit boundary.
Connection Management in TCP Opening a TCP Connection Closing a TCP Connection Special Scenarios State Diagram
TCP Connection Establishment TCP uses a three-way handshake to open a connection: ACTIVE OPEN: Client sends a segment with SYN bit set * port number of client initial sequence number (ISN) of client PASSIVE OPEN: Server responds with a segment with SYN bit set * initial sequence number of server ACK for ISN of client Client acknowledges by sending a segment with: ACK ISN of server (* counts as one byte)
Figure : Connection establishment using three-way handshaking
Figure : Connection termination using three-way handshaking
The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It does not add anything to the services of IP except to provide process-to-process communication instead of host-to- host communication. provide unreliable service
Table : Well-known ports used with UDP
Figure : User Datagram Format
UDP Format Source and destination port : 16 , 16 identify applications at ends of the connection length: 16 - length of datagram including header and data c h ec k s u m : 1 6 - on e ’ s com p l e m e nt of header and data including pseudo data
UDP for Application TFTP DNS RPC, NFS SNMP
Figure : Pseudo header for checksum calculation
Figure : Queues in UDP
TCP UDP Transmission Control Protocol User Datagram Protocol C o n n e c t i o n Or i e nt e d Con n e c t i on L es s Slow Fast Highly Reliable Unreliable 20 Bytes 8 Bytes It takes acknowledgement of data and has the ability to retransmit if the user requests. It neither takes acknowledgement, nor it retransmits the lost data. TCP is heavy-weight. UDP is lightweight.
Stream-based Message-based Delivery of all data is managed Not performed Flow control using sliding window protocol None TCP doesn’t supports Broadcasting. UDP supports Broadcasting. Small to moderate amounts of data Small to enormous amounts of the data Applications where reliable transmission of data matters. Application where data delivery speed matters. F T P , T e l n et , S M T P , IMA P . DN S , B O O T P , D H C P , T F T P .
A protocol is designed to handle real-time traffic (like audio and video) of the Internet, is known as Real Time Transport Protocol (RTP). RTP must be used with UDP. I t do es no t h ave any d eliv e ry m e c h a n i s m li k e multicasting or port numbers. R TP s u ppo rts d i f f erent f o r m ats o f f iles li k e MPEG and MJPEG.
It is very sensitive to packet delays and less sensitive to packet loss. RTP is first time published in 1996 and known as RFC 1889. And next it published in 2003 with name of RFC 3550.
R TP m a i n l y h e lps i n m ed i a m ix i ng, sequencing and time-stamping. Voice over Internet Protocol (VoIP) Video Teleconferencing over Internet. Internet Audio and video streaming.
Version : This 2-bit field defines version number. The current version is 2. P –The length of this field is 1-bit. If value is 1, then it denotes presence of padding at end of packet and if value is 0, then there is no padding. X –The length of this field is also 1-bit. If value of this field is set to 1, then its indicates an extra extension header between data and basic header and if value is then, there is no extra extension. Contributor count –This 4-bit field indicates number of contributors. Here maximum possible number of contributor is 15 as a 4-bit field can allows number form to 15. M –The length of this field is 1-bit and it is used as end marker by application to indicate end of its data. Payload types –This field is of length 7-bit to indicate type of payload. We list applications of some common types of payload.
Sequence Number –The length of this field is 16 bits. It is used to give serial numbers to RTP packets. Time Stamp –The length of this field is 32-bit. It is used to find relationship between times of different RTP packets. Synchronization Source Identifier –This is a 32-bit field used to identify and define the source. The value for this source identifier is a random number that is chosen by source itself. Contributor Identifier –This is also a 32-bit field used for source identification where there is more than one source present in session.