0% found this document useful (0 votes)
49 views30 pages

Transport Layer

Uploaded by

Dev Khatanhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
49 views30 pages

Transport Layer

Uploaded by

Dev Khatanhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 30
Computer Networks (Comp-MU) 4, Transit dela Itis the time duration between a message being sent by the transport user from the source machine and it being received by the transport user atthe destination machine. Residual error ratio: — _Temeasures the number of lost or garbled messages asa percentage ofthe total messages sent = Weally the value of this ratio should be zero and ractially it should be as small as posible, 6 Protection : This parameter provides a way to protect the transmitted data against reading or modifying it by some unauthorised partis. 1. Priority : Using this parameter the user can show that some of ts ‘connections are more important (have higher priority) than the other ones. = Thisis important when congestions take place. Because the higher priority connections should get service before the low priority connections. Resilience: Due 10 internal problem or congestion the transport layer spontaneously terminates a connection. The resilience parameter gives the probability of such a termination, 6.4 Transport Service Primitives “What are transport service primitives ? Discuss ret. (Dec. 15, 10 Marks) What are transport service primitives ? Explain. ee (Dec. 17, 10 Marks) = The transport service primitives allow the transport user such 2s aplication programs to access the transport service = Bach transport service has its own acces primitives = The transport service is similar to network service but there are some important diferences. The main difference is that the connection-oriented transport service is reiable, ~ The second difference between the network service and transport service is whom the services are intended for. The transport primitives are seen by many programs and programmers. Hence the transport service is convenient and easy to use. ~ We can get the idea about the transpor services by referring to Table 64.1 which ists the five primitives, Transport Lay ‘Table 6.41 + Primitives fora simple transport service Sr] Priniive] TPDU sent Meaning No. y 1, | LISTEN ‘None Block until some process tres 0 @ [CONNECT | Connection | Actively attempt to request establish a connection 3_| SEND Data Send data RECEIVE | None Block until a data [TPDU arrives 5. | DISCONNECT | Disconnection | Release the connection request | 0.2 What are transport service primitives ? Explain. = The transport interface allows the application programs t0 establish, use and release connections. = Let us see bow these primitives are used in actual applications 1, The server executes a LISTEN primitive. This will call to block the server until a client 2. When a client wants to tlk to the server it executes the CONNECT primitive. 3. In response the transport entity blocks the caller and sends a packet to the server. The transport laver ‘message is encapsulated in the payload of this packet for the server's transport entity Tepu: ‘The message sent from transport entity called as transport protocol data unit or TPDU. 6.4.1 Nesting of TPDUs, Packets and Frames : Pani @,1. What are transport service primitives ? Discuss in bret. (Dec. 15, 10 Marks) to transport entity is (Dec. 17, 10 Marks) ~The TPDUs which are exchanged by the transport layer are conuinod in the pockets that ace exchanged by the network layer. ~ These packets are in tr contained inthe frames which are exchanged bythe data ink yer. = When fame aves, the data tink layer process the frame header and pases the contents ofthe fame payload field to the network entity. TPOUS wsnenenenne Transport ayer Packets Network layer Frames Data ink ayer (6-394) Fig. 64.1 fechKnowledyé Scanned by CamScanner Computer Networks (Comp-MU) 619 Transport Layer 4: Stream socket : is designed for he conncton one tcl sch a TCP. The TCP wes pir of seam ponte on x on titer ends for comeing oe apaon program to other across the Internet. a 2. Datagram socket ~ This type of socket is designed for the connectionless protocol such as UDP. UDP uses a pair of datagram sockets for sending a ‘message from one. application program to another across the Internet. 3. Raw socket = Raw sockets are designed for the protocols like ICMP or OSPF, because these’ protocols do not use either steam packets or datagram sockets, Fig. 65.2 shows the three types of socket types. [Se Aeticaton program Ea Prsatedaeieee a (6-02) Fig. 65.2: Type of sockets 6.5.2 Berkeley Sockets : erin F Wite short notes on : Berkeley sockot, : (Dec. 09, Dec. 11, May 13, 6 Marks) Q:2 Show the usage of the diferent _ socket “programming primitives used for establishing @ connection between client and server. ce (Dee, 13, 10 Marks) 2.3. White short note on Berkeley Socket, : UNIX for TCP. ‘Create a new communication end point Se] Primitive Meaning No. 2_| IND Provide a local address a socket LISTEN _ | Show willingness to accept connections , [ACCEPT — | Block te caller as long as a connection attempt does not arrive 5._| CONNECT _| Attempt to establish a connection 6,_| SEND Send data 7._| RECEIVE _| Receive data | cLose | Release the connection “The first four primitives ia the Table 6.5.1 are executed in the same order by the server. ‘The SOCKET primitive creates a new end point and allocates lable space fort within the transport entity “The newly created sockets do not have addresses. These are assigned using the BIND primitive. ‘The LISTEN primitive allocates space to queve the incoming calls in case if several clients wish to connect at the same time. To block waiting for an incoming connection, the server executes an ACCEPT primitive. When a TPDU requesting for a connection arrives, the transport entity creates a new socket and returns a file descriptor for it. ‘These were the primitives comesponding to server side. Now let us consider the client side. (On the client side also a socket needs to be created frst using the SOCKET primitive, however the BIND is not required, ‘The CONNECT primitive blocks the caller and initiates the connection process. When it completes (Which is indicated by an appropriate TPDU received from the server), the client process unblocked and the connection is established. ‘After this both the sides can use SEND and RECEIVE primitives to send and receive data, In onder to release the connection, both sides have to execute ‘CLOSE primitive. Steps followed for Socket Programming : Server side The steps followed for the socket programming ae as follows : Server creates a socket and checks for errors using SOCKET. Assign adress tothe newly created socket using BIND, Use the LISTEN to allocate space forthe queue whichis used for the incoming calls, Execute an ACCEPT for blocking the waiting incoming connections. TeehKeautedy Scanned by CamScanner WB compurr Noworks (Comp: MU 14 Transport ay Client side : 1, Create socket using SOCKET. 2. Use CONNECT to initiate connection process. 3" Establish the connection 6.5.3 Connectlonless Iterative Server = Let us-now discuss connectionless, iterative client-server ‘communication using UDP and datagram sockets = The server that uses UDP is usually connectionless iterative, So the server serves one request a time. = A-server gets the request received in a packet from UDP, it processes the request and gives the response to UDP to send ito the client. = The server does not pay any attention to the other packets = The other packets are stored in a queue waiting for the service. They ar processed one by one, ~The server uses one single port for this purpose, the well known port. ~All the packets ariving at this port will waitin line to be served, ‘Server functions : ‘The server performs the following functions (Create & socket : The server asks the operating system to create a socket 2 Bind : The server asks the operating system to enter information in the socket related to the server. This is called as binding the server socket. 3. Repeat : The server repeats the following steps for infinite numberof times. (@) Receive request (©) Process : The requests processed by the sever. (© Send : The response is sent the client CClents functions. ‘The client performs following factions LL Create a socket : The client asks the operating system to create a socket. There i no need of binding 2 Repeat: The clit repeats the following steps as long as it has requests, (2) Send + Cleat asks the operating system to send a request (b) Receive : Cleat asks the operating system to wait for the response and deliver it when it has arived, 3, Destroy + When the client does not have any more requests, asks the operating system to destroy the socket, 6.5.4 Connection Oriented Concurrent Server: - The oriented concurrent client serey ‘communication uses TCP and stream socket. The serves, using TCP are normally of concurrent type. That means » ‘connection server i serving many clients atthe same time The type of communication is connection oriented. Once a ‘connection is established, it remains established until emir stream of bytes is processed. After that the connection js terminated. = The server must have one buffer for each connection. The bytes from the client are stored in buffers and hand concurrently by the server. ~ In order to provide this type of server, the concept of pret and child server suse. Parent server : = Apparent server isthe server running infinitely and accepting connections from clients. It uses the well known por. = After establishing a connection, the parent server creates 3 ew server called as a child server and an ephemeral post 9 allow the child server to handle the client. ‘Server function : “The server performs following functions: 1. Create a socket : The server asks the operating system 10 crete a socket. 2 Bind + The server asks the operating system t0 cet information in the socket. 3: Listen : The server asks the operating system to be past and listen to the client which needs to be connected to this server. Tis is because TCP is a connection oriented prot! 0 connection needs to be made before transfering the dst 4, Repeat : Tho server repeats the steps given below infil (0) Create a child : When a child requests a connet" the operating system creates a temporary oil process and assign the duty of serving the client the child. The parent process is then free for seine to now clients. Technaute Scanned by CamScanner Computer Networks (Comp-MU) oa *ognizing the dptons pate sce sequence number is equied french es recive so hep thos of toqeicc marke ote host for a specie an —— Pecifle amount of time but not portant problems : = Buublishig a connection sound : unds easy. But actually it is & ver tcky jb. The problem occurs hen he net on Jose store and duplicate packets, ” = Theproblems canbe elaborated a8 follows 1, Due to congestion on a subnet, the acknowledgements 40 not get back in time from receiver to sender. So re- ‘transmission of each packet takes place 2. If the subnet uses datagrams inside and every packet ‘travels on a different route, then some of the packets ‘might get stuck ina trafic jam and take a long time to ‘The same connection getting re-established due to duplication of packet. = So the crux of the problem is existence of delayed duplicate packets + The solution to this problem is to kill off the aged packets that are still wandering on the network. = We should ensure that no packet lives longer than some predecided time. ~The packet lifetime can be restricted by using one of the following techniques: Restricted subnet design 2. Putting a hop counter in each packet, 3, Time stamping each packet. 6.7.2 Three Way Handshake Technique AEE pean i ‘Explain three way handshake technique in TOP: ee (May 10, May 11, 10 Marks) a Explain the three protocol scenarios for establish “a connection using a S-way handshake In TOP, : (May 12, 10 Marke) Show the. alifrent protocol scone ee stablishing a connection using 3-way handshake In ron (Dec. 13, 10 Marks) jndshake technique In TCP. if 16, 10 Marks) Transport Lay = The delayed duplicate packet problem can be solved by using a technique called three way handshake. = The principle of thee way handshake is shown in Heat Hoa (oF = Cennetion request cK = Acknoiedgamer Te Tie (6-405) Fig. 6:7.2(a) : Three way handshake technique Normal operation : 1, Host 1 chooses a sequence mumber x and sends a TPDU containing the connection request (CR) TPDU to host 2. 2, Host 2 replies with a connection accepted TPDU to acknowledge x and to announce its own sequence number y. 3, Host 1 acknowledges host 2 and sends the first data TPDU to host 2. Operation in the abnormal circumstances : ~~ Now let us see how the three way handshake works in piesence of delayed duplicate control TPDUs. = Refer Fig. 6.7.2(6). The first TPDU is a delayed duplicate CONNECTION REQUEST from an-eld connection. The HOST 1 does not know about it Host t Time: Tine (6-606 Fig. 6.7.2(b) : Response to an OLD duplicate = Host 2 receives this TPDU and sends to host 1, a connection accepted TPDU. = But host 1 is not tying to establish any connection so it sends a REJECT alongwith ACK = y. Paes Scanned by CamScanner uter Networks (Comp-MU) ‘So host 2 realizes that it was fooled by a delayed duplicate ‘and abandons the connection, Duplicate CR and duplicate ACK: ‘Tris is another abnormal situation. Refer Fig. 6.7.2(¢) 0 understand this situation, {(G-s07 Fig. 6.7.2) : Duplicate CR and duplicate ACK ‘This is the worst case in which delayed duplicates of both ‘connection request (CR) and acknowledgement (ACK) are ‘making rounds inthe subnet Host 2 gets a delayed duplicate CR and it replies to it by sending ACK. Note that host 2 has proposed a connection witha sequence number y, ‘When the second delayed TPDU (duplicate) arrives at host 2 it understands that 2 has been acknowledged and not y. So it understands that this too isan OLD duplicate: 6.7.3 Connection Release : ‘Any one of the two parties involved in data exchange can close the connection, But the problem is tha, when connection is terminated from ‘one end, he other party can continue to send data in the other direction, Hence, 10 ensure a proper connection release one has to follow the steps given below. Procedure to release a connection : ‘Refer Fig. 6.7.3 to understand this procedure, Host | sends a connection release request to host 2, Host 2 sends an acknowledgement to confirm the release ‘equest of host | 3. After this the connection is closed in one direction (no data, {fom host 1 thos 2 but how 2can continue to send dao 6.8 Transport Lye, ‘When host 2 finishes sending his data, it sends a connec, release request to host 1. Host 1 acknowledges (confirms) the request made by joy » and the connection is released from both ends. : Host 2 = Hoot } Connect rooase roxio 102 | Keknowledgemont Connacton release aquest 210 1 Hl Tacleonledgement| Time Tine (6-409Fig. 6.73: Connection release Releasing a connection is easier than establishing it The are two styles of releasing a connection: ‘Types of connecting release : 1. Asymmetric release and 2, Symmetric release A. Asymmetric release : In asymmetric release, when one party stps communicating the connection is broken. It is a2 abrupt release and it may lead to loss of data, ‘Symmetric release : ‘Symmetric release treats the connection as two sears ‘unidirectional connections and ia order to release connection each side must release the connection 00 iS ide. ‘Symmetric release is as shown in Fig. 6.73 and ther ‘no loss of data with the symmetrical release The Internet Transport Protocols (TCP and UDP) : ‘The Internet as two main protocols i the transpor HY One of them is connection oriented and the otes ° supports the connectionless service, ‘TCP (Transmission Control Protocol) is a conectot oriented protocol and UDP (User's Data Protocl) is connectionless protocol ‘UDPis basically just IP with an additional short Kade wreett Scanned by CamScanner WF computer Networks (Com 69 Uy User Datagratn Protocol (UDP) : = The User Datagram Protocol is a very simple protocol, It adds litle to the basic functionality of IP. Like TP, it i unreliable, connectionless protocol. = You do not need to establish a connection with a host before exchanging data with it using UDP, and there i ‘mechanism for ensuring that data sent is received, = A onit of data sent using UDP is called a Datagram. UDP adds four 16-bit header fields (8 bytes) to whatever data is sent, = These fields are : a length field, a checksum field, and source and destination port numbers. “Port number”, inthis context, represents a software port, nota hardware port. = The concept of port numbers is common to both UDP and ‘TCP. The port numbers identify which protocol module sent (ors to receive) the data. Most protocols have standard ports that are generally used for this. For example, the Telnet protocol generally uses port, 23. The Simple Mail Transfer, Protocol (SMTP) uses port 25. The use of standard port numbers makes it possible for clients to communicate with 2 server without fist having to establish which port to use. = The port number and the protocol field in the IP header duplicate each other to some extent, though the protocol field is not available to the higher-level protocols. IP uses the protocol field to determine whether data should be passed to the UDP or TCP module. = UDP or TCP use the port number to determine which application-layer protocol should rceive the data = Although UDP isn’t reliable, itis stil a preferred choice for ‘many applications, It is used in real-time applications like [Net audio and video where, if data is lost, its better to do ‘without it than send it again out of sequence. Iti also used by protocols like the Simple Network Management Protocol (SNMP). Relationship with other protocols : = The relationship of UDP with the other protocols and layers ‘of TCP/IP suite is as shown in Fig. 6.9.1. As shown, UDP is focated between IP and application layer. It therefore works 8 an intermediary between application program and the network layer SMTP, FTP, ONS, HOP [ac sctr, Tor, bP TP, ARP, IGMP, [OMP ‘Application layer ‘Transport layer "Notwork layer ; eee bem nce is eSsog [Pres e etme UDP and te roa (Gang) Fig, 69.1 : Relation 6.25, Transport Layer, 6.9.1 = Being a transport layer protocol, the UDP has the following responsibilities 1. To create a process to process communication, UDP ses port numbers to accomplish this. 2. To provide control mechanisms at the transport layer, UDP does not provide flow control or acknowledgements, It provides error detection, The erroneous packet is discarded. 3, UDP does not add anything to the services of IP except for providing process to process 6.9.2 Advantages of UDP = UDP, despite alts simplicy and poweressnes is still used because i offers the fllowing advantages 1. UDP has minimum overheads 2, UDP can be eaily‘used if the sending process isnot too bothered about reliability 3. UDP reduces interaction between sender and receiver. Responsibilities of UDP : 6.9.3. User Datagram : = User Datagram Protocol (UDP) provides a connectionless packet service that offers unreliable “best effor” delivery. ‘This means thatthe arrival of packets isnot guaranteed, nor is the corect sequencing of delivered packets. = Applications that do not require an acknowledgement of receipt of data for example audio or video broadcasting uses pr. UDPiis also used by applications that typically transmit small amounts of data at one time, for example, the Simple [Network Management Protocol (SNMP). = UDP provides a mechanism that application programs use to. send data to other application programs. UDP provides protocol port numbers used to distinguish between multiple ‘programs executing ona single device. That is, in addition to the data sent, each UDP message contains both a destination port number and a source port number. This makes it possible for the UDP software at the destination to deliver the message to the correct application program, and forthe application program to send a reply. = UDP packets aro called as user datagrams. They have a fixed-size header of &-bytes. The format of user datagram is as shown in Fig. 69.2 — Bbyt0s 4 [ies] oe] Destination port umber 16 bits Total ongth seks (G-026Flg, 69.2 : User datagram format ‘Source port number 16 bits Technet Hester Scanned by CamScanner Computer Networks (Comp-MU) 6.26 Transport Layer ~The UDP header is divided imto the following four 16-bit fields : 1. Source port 3. Total length 2 Destination port 4, Checksum. Source Port Number : = Source ports an optional el, when meaning, itindictes the port of the sending process, an may be assumed to be ‘the port to which a reply should be addressed ia the absence ‘of any other information. IF not used, a value of zero is inserted. = Thisis a 16 bit eld. That means the port numbers can range from 0t0 65,535, = If the souee host is a client, means if a client is sending @ request using UDP, then generally a ephemeral (temporary) Port number is requested by the process and choten by the ‘UDP. — Ifthe source host isa server thai means ia server is sending response message, most the well known port number is ~ sed. Destination Port Number : ~The destination port number also isa 16 bit number and this port number is used bythe press running on the destination host. = If the destination host isa server that means if client is sending a request to it, then a well known port number is sed in most cases. = However if the destination host is client than means if a server is sending its response to it, then the chosen port ‘number is generally an ephemeral port number. Length = Its also a 16 bitfield which is used for defining the total length ofthe UDP datagram including header as wel as data. Due to 16 bit length it can define a total tength of the atagram upto 65,535 byes = However practically the total length of a UDP datagram is rmuch smaller than 65,535 bytes. This is because the UDP datagram isto be stored in an TP datagram which tet has 9 Iength of 65,535 bytes. = The length field’ in the UDP. datagram is scaly not necessary, because this UDP datagram is "actually ‘encapsulated in an IP datagram and the IP datagram has is own length field = So without using the length field in UDP datagram, we can ‘obtain the length ofthe UDP datagram as follows UDPiength = IP length IP header length = Note that while delivering the UDP datagram to UDP layer UDP Checksum : he integrity (i.e. to detect errors) ofthe ‘This is sed to verify th ‘on a “pseudo header” UDP header, The checksum is performed consisting of information obtained from the IP beader (Source and destination address) as well a the UDP header. 6.9.4 UDP Pseudo Header + = The purpose of using a pseudo-header is to verify that UDP packet has reached its correct destination. fic machine and 3 = The correct destination consists of a. speci specific protocol port number within that machine. ° ra [es (6-0 Fig. 69.3 : UDP pseudo header = The’ UDP header itself specifies only the protocol pos ‘number. Thus, to verify the destination, UDP on the sending ‘machine computes a checksum that covers the destination IP ‘address as well asthe UDP packet. = At the ultimate destination, UDP software verifies the checksum using the destination IP address obtained from the header of the IP packet that carried the UDP message ~ If the checksum agrees, then it must be true thatthe packet has reached the intended destination host as well as the correct protocol port within that host. User Interface : = A user interface should allow the creation of new receive ports, receive operations on the receive ports that retum the data octets and an indication of source port and source address, and an operation that allows a datagram to be sent specifying the dats, source and destination ports and ‘addresses tobe sent. IP Interface : = The UDP module must be able to determine the source and destination Internet addresses and the protocol field from the Internet header, = One possible UDPP interface would retum the whole Intemet datagram including the entire Intemet header is tespons to eciv operation, Such an interac woul io allow the UDP to passa full Internet ‘complete with header tothe IP send, aoe the IP software dops the IP header. = The IP would verify cenain elds for consistency and ‘compute the Internet header checksum = Teehknvatest Scanned by CamScanner protocol Application and the Trivial File Transfer. protocol Number : = This #8 protocol 17 (21 octal) when used eel the Iniemet ‘The dump of a UDP header in hex Terra ne UDP Header in hoxadacial BC82000D002B001D bia the following from it 1. Source port number 2, Destination port number 3. Total length 4. Length of the data, 5. Packet direction. 6. Name of client process. soln. : The standard format of UDP header has been shown in Fig. P.69.1. f= B bytes —o} Which shows that for well known port number 13, the corresponding client process is “Daytime”, 6.10 UDP Services : = In this section we ate going to discuss the following {mportant services provided by the UDP. Process to process communication. Connectionless services, Flow contr. Error control. Checksum. Congestion conto. Encapsulation and decapsul Queuing Multiplexing and demultiplexing. 6.10.1 Process to Process Communication = We have already discussed the process to process ‘communication ina general sense, earir inthis chapter. 2 a 4 5. 6 1 8 8. = UDP also does it with the help of sockets which is a combination of IP address and port numbers. Table 6.10.1 shows diferent port aumbers used by UDP. ‘Some of these ports can be used by UDP as well as TCP. Table 6.10.1: Well known ports used with UDP. Protocol | Description 7 | Bebo | The received datagram is echoed back to -—— 22 bis +t cele 9 | Discard | Any received datagrams discarded. (cana Fig. P- 69.1 : UDP header format Gill tues increas = Therefore we can splithe given UDP headerin equal pars || 13 [Daytime | Rerum he day andthe cunt tine. as follows 17 | Quote | Return the quote of he day. BC82 000D 0028 0010, 19 | Chargen | To retuma string of characters. Scirce pot ] L Lecnecteum |{s3 | Nanesener | Donia Nene Serie NS). ee Length 67 | BOOTRS | This is te server port to download the ‘number bootstrap information, ae 68 | BooTeC | This is the client port to download 1. Source port umber = (BC82)4 wns. bootstrap information 2. Destination port number = (000D), veas. 169 [7 Tete | Trivial File Transport Protocol, 3. Tal engthof UDP packet =(0028)«=3)ete8 UT inn [rc | Remo Proved Cal 123 [_NTP_| Nework Time Protocol, 4. Length of data = Toa length Length of hehesters | 161 | Sage _| simple Nework Manageteat Protocol 43-8 = 35 byles wAm 1 Trea | swMP | simple Network Management Prooco 5. Destination port aumber is (000D)6= (13) np) 3 ~ this a wellknown port Hence the diretion of UDP packet save is from cient to server. 6 The client process can be obtained from Table 6.10.1 ates Scanned by CamScanner “Computer Networks (Comp-MU) 6.10.2 Connectionless Services : ~ As UDP is a connectionless, unreliable protocol, each user datagram sent using UDP isan independent datagram, Different user datagrams sent by the UDP have absolutely no relationship between them, This is true even for those datagrams which are originating from the same process and being sent to the same destination, The user datagrams do not have any number, ~ Also the connection establishment and release are not at all ‘equired, So each datagram is free to travel any path. = Only those processes which are sending very short messages ‘can successfully use the UDP. 6.10.3 Flow and Error Control : ~ Being a connectionless protocol, UDP is a simple, unreliable protocol. It does not provide any flow control, hence the receiver can overflow with incoming messages, = UDP does not support any other error control mechanism, ‘except for the checksum. There: are no acknowledgements sent from destination to sender. Hence the sender does not know if the message has reached, lost or duplicated. If the receiver detects any error using the checksum, then that particular datagram: is discarded. 6.10.4 Checksum: = The calculation of checksum for UDP is different than that for IP. In UDP the checksum is calculated by considering the following three sections 1. A pseudoheader 2. The UDP header. 3. The data coming from the application layer. ~The checksum in UDP is optional. That means the sender ‘ean make a decision of not calculating the checksum. If s0, then the checksum fields filled with all zeros before sending the UDP packet = In case if the calculated checksum is all zeros (when the sender decides to send checksum) then an all 1 checksum is sent. = This solution works without any problem because, a checksum will neverhave anal I value 6.10.5 Congestion Control = UDP does not provide any congestion contol. It assumes that the UDP packets being small, will not create any congestion. — But this assumption may not always be correct 6.10.6 Encapsulation and Decapsulation ~The UDP encapsulates and decapsulates messages in an IP datagram in order to exchange the message between two ‘communicating processes. 628 ‘Transport Layer = This is as shown in Pig, 610.1. We will discuss the wo processes separately. ‘Sencirg process oP satan (b) Decapsulation (Ga02y Fig. 610.1 (a Encapsulation Encapsulation : Refer Fig. 6.10.1(2). The message produced by a process is to be sent with the help of UDP. The process passes the -mestage and two socket addresses alongwith the length of data to UDP. = UDP receives this data and adds the UDP header to it as shown. This is called as UDP datagram which is passed to IP with the socket address = TPadds its own header to UDP datagram as shown. It enters value 17 into the protocol field. This is an indication chat UDP is being used. The IP datagram is then passed on tothe ata lnk layer. = The DLL adds its own header and possibly a trailer to create frame and sends itt the physical layer. = Finally te physical layer converts these bits into electrical or optical signals and sends them tothe destination machine. Decapsulation : = Refer Fig. 6.10.1() for understanding of the decapsulation process. The encoded message arrives at the destination physical layer where it decodes the electricaVoptical signals into bits and passes them to the DLL ~The DLL checks the data using header and trailer. The header and trailer are discarded if no errors are found, and the datagram is passed to IP. ~The IP cartes out its checking to find the errors and if none are found, the datagram is passed on to UDP, after dropping the IP header. % = The datagram from IP to UDP also contains the sender and receiver IP addresses, This entire user datagram is checked by the UDP with the help of checksum, = there is no error detected, then the UDP header is dropped and the application data plus senders socket address are hhanded over tothe process. Scanned by CamScanner Computer Networks (Comp: MU! = The process can use this senders socket address if it wants to respond to the message received. 6.10.7 Queuing = The queues in UDP are related with ports a6 shown in Fig. 6102. ay te cont Day time sone gory Incoming queue ‘a (6-426 ig. 6.10.2 : Queues in UDP = A process starts atthe client site by requesting a port number from the operating system. In some implementations both incoming and outgoing queues are created ia association with cach process. . Every process gets only one port number and hence it can ‘create one outgoing and another incoming queve. The queues function only when the process is running. They are destroyed as soon asthe process is terminate. =. The client process uses the source port number mentioned in the request to send message to its outgoing queue. = = UDP removes the queue messages one by one by adding the ‘UDP header and delivers them to IP. ~ Ifthe outgoing queue overflows, then operating system tells that client process to wait before sending the next message. "When the client receives a message, UDP checks if the incoming queue has been created or not If the queue has ‘een created, then the UDP sends the received datagram to the ead of the queve. = Tf the queue is not present then UDP will simply discard the user datagram. If the incoming queue overflows, then UDP discards the user datagram and arranges’ to send the port unavailable message to the server. =, The mechanism to create the server queue is different. The server creates the incoming and outgoing queues using its ‘well kaown port as soon as it starts running, The queues exist as long asthe server is running, ~ * When a message is received at the server, the UDP checks if the incoming queue has been created or not. Ifthe queve is not present, the UDP discards the user datagram. If the queue is present then UDP sends the datagram atthe end of the queue. ~~" If the incoming queue overflows, then UDP drops the user datagram and arranges to send the port unavailable message tothe client Transport = When the server wants to send a message to client it sends that message tothe outgoing queue. These messages are then removed one by one after adding the UDP header. They are delivered 1 IP. = Ifthe outgoing queue overflows then the operating system will ask the server to wait before it sends the next message. 6.10.8 Multiplexing and Demuttiplexing : = We have discussed the general principle of multiplexing and “demultiplexing in the taneport layer. = Now let us see how to apply the same principle to UDP. Imagine that a host is running a TCP/IP protocol suite and that there is only one UDP and a number of processes which Would lke to use the services of UDP. UDP handles such a situation by using the principle of ‘multiplexing and demultiplexing as shown in Fig. 6.103. Procosses Processes ] El PN (U0) (G-202» Fig. 6.10.3 : Multiplexing and demultiplexing Multiplexing : = At the sending end, there are several processes that are interested in sending packets. But there is only one transport layer protocol (UDP or TCP), Thus it is a many processes- ‘one transport layer protocol situation. Such a many-to-one relationship requires multiplexing. =" The UDP first accepts messages from different processes. ‘These messages are separated from each other by their port ‘numbers. Bach process has unique port number assigned to it = Then the UDP adds header and passes the packet to IP as shown in Fig, 6.103. Demuttiplexing : - At the receiving end, the relationship is one as to many, So ‘we need a demultpiexer, '~ First the UDP layer receives datagrams from the IP. = The UDP then checks for error’ and drops the header to ‘obtain the messages and delivers them to appropriate process ‘based on the port number. ee Scanned by CamScanner Computer Networks (Comp-MU) 6.10.9 Comparison of UDP and Generic Simple Protocol : = In this section we will compare UDP with a cconnectionles transport layer protocol = The only difference between the two is that the UDP ‘provides an optional checksum, = If the checksum is added to the UDP packet then at the destination, the receiving UDP can check the packet for any ‘ctor withthe belp ofthe checksum. ~ If any eror is detected, the receiving UDP will discard that packet, without sending any feedback tothe sender. imple 6.11 . UDP Applications : Despite being connectinless, unreliable, no flow control, no error control, UDP is sill prefered for some applications. This is because UDP has some advantages too. An application designer has to sometimes compromise between advantages and drawbacks t get the optimum. — "Here we will discuss some important features of UDP that _are useful in designing an application program. 6.12 UDP Features : 6.12.1 Connectionless Service : +The feature of UDP is that its aconnectionless protocol and tat each UDP packet is independent from the other packets, ean be considered as an advantage or a. disadvantage depending on the requirements of an application. ~ Iman application, if we want to send only short messages to server and receive short messages from the serve. Then the above mentioned feature becomes an advantage, = The feature of being connéctionless is an advantage if request ‘and respond each can fit in one single user datagram, = The overhead (number packets to be exchanged) required to establish and close a connection is zero in case of UDP. This can be a very important advantage for some applications. Similarly the delay involved with the connectionless delivery is very short. as compared to that with the connection oriented The relationship between TCP and IP is very interesting Each TCP message gets encapsulated or inserted in an IP ‘atagram and then this datagram is sent over the Intemet to the destination. ~ BP wansports this datagram from sender to destination, without bothering about the contents ofthe TCP message. = Atthe final destination the IP hands over the message tothe {TCP software running on th destination computer. = acts tke postal service and transfers the datagrams from ‘one computer tothe other. Thus TCP deals withthe actual data to be transfered and TP takes care of transfer of that data. = Many applications such as FTP, Remote login TELNET etc Leveeeing dat TCP waar onthe ending compte = The TCP software acts as a muliplexer at the sending ‘computer, Tt receives data from various applications, fhuldplenes the data and hands it over tothe IP software at the sending end as shown in Fig 6.13.1. ~ BP adds its own header to this TCP packet and creates an TP ‘packet out oft Then this packet is sent to its destination : ss wil take place ~ Atte destination exactly opposite proce ‘The IP software hands over the multiplexed data to the TCP software. ~The Top demultipenes the multiplex comesponding applications a. software at the destination computer then od data and gives it 10 the shown in Fig. 6.13.1. ‘Arpleaton pagans ‘Aeration programs ‘heonder the gecnaton TF Tor uvtotoan (cumiisonen) 1° he Payal Pryseal eter ra Qo (¢-14m Fig, 6.13.1 : Maliplexing and demultiplexing using Tc 6.13.2 Ports and Sockets : 1. > Ports: = Applications running on different hosts communicate with ‘TCP with the help of ports. Every application has been allotted a unique 16 bit number whichis known as a port. = When an application on one computer wants to communicate ‘using a TCP connection to another application on some other ‘computers these ports prove tobe very helpful = Letan application A on host 1 wants to communicate with an application B on host 2. So the process takes place as shown in Fig. 6132 and explained below. ‘options (6-167 Fig. 6.13.2 : Use of port numbers = Application A running on computer 1 provides the IP address ‘of computer 2 and the port number comesponding to application B as shown in Fig, 6.13.2. Scanned by CamScanner ‘Computer Networks (Comp-MU) = Computer 1 communicates with computer 2 using the IP address and computer 2 uses the port number to direct the ‘message to application B, 2 Sockets: A port is a 16 bit unique number used for identification of a single application, Bot socket address or simply socket would identify the combination of the IP address and the port number 602 6.14.1 Process to Process Communication ‘The TCP uses port numbers a transport layer addresses, ‘Table 6.14.1 shows some well known port numbers used by Te, = Note that if an application ean use both UDP and TCP, the same port number is assigned t this application. ‘Table 6.14.1 : Well known ports used by TCP For example if the IP address = 193,25.10.12 and the port Toprol | Description Ser eee a a et SS following socket address. i pes Sain a >| er areca ‘Port 13 Daytime | Sends the date and the time Seine |] ES sad oe tetas (100 Fig, 6133 20 | FTP, Data | Fite Transfer protocol for data ~ Soaprir of sockets is required to identify a TCP connection] 24 FIP, Control _| File Transfer protocol for control ‘between two applications on two different hosts. These (wo ry - a ok socket addresses specify the end points of the connection as bs re nr Se eee sen = St Pewee See = ole er een ee (G-1s6 Fig. 6.134 : Source and destination port numbers = Generally the server port numbers are known 2s the well known ports. Some of the well known port numbers have already been mentioned for UDP and TCP earlier in this chapter. = Multiple TCP connections between diferent applications or same applications on two hosts exis in practice. Here the IP addrestes ofthe two hosts are same but the port numbers are éifferent. = The communieation using port numbers is illustrated in Fig. 6.134, 6.14 TCP Services: Following are some of the services offered by TCP to the processes atthe application layer Stream delivery service Sending and receiving buffers Bytes and segments Full duplex service ‘Connection oriented vervice Reliable service, Process to process communication SAR a eDe 6.14.2 Stream Delivery Service : = TCP is a stream oriented protocol. The sending process delivers data in, the form of a stream of bytes and the receiving process receives it in the same manner. TCP creates @ working environment in such way thatthe sending and receiving processes seem to be connected by an imaginary “tube” as shown in Fig. 6.14.1. This is called as stream delivery service. ‘Sending procoss Receiving process Imaginary tube cay thodata groom? (-sa0Flg. 6.1441: Stream delivery service 6.14.3 Sending and Receiving Buffers ~The sending and receiving processes may not produce and receive data atthe same speed, TechKnowledgé Scanned by CamScanner Computer Networks (Comp-MU ese TP redseton or ong dan tbo en ‘There are two types of buffers used in each diecton: “s i eeeeincee ter A buffer can be implemented Receiving buffer. by using a circular array of 1 byte locations as shown in Fig 6.14.2. sending process Rocahving Noxt byte _Noxttyte Tobesent tobe recelved 6-33 Transport ‘The Segments are then inserted in an IP datagram and transmitted. The entire operation is transparent to the receiving process. ‘The segments may be received out of order, lost or corrupted when it reaches the receiving end. Fig. 6.143 shows the creation of segments from the bytes in the buffers. ‘Sending TOP Recoling TOP D1 Empty locations D1 Bytes cont but acknowledgement Ienat received BB Bytestobe sont (G-aFig. 6.142 : Sending and receiving bsfers Fig. 6.142 shows the direction of movement of data. The sending buffer has three types of locations 1, Empty locations Emp locations 2, Locations containing the bytes which have been sent bat not acknowledged, These bytes are kept in the baffer till an acknowledgement is received 3, The locations containing the bytes to be sent by the sending TCP. In practic, the TCP may be able to send only a part of data Which is to be seni, doe to slowness of the receiving process or congestion in the network. ‘The buffer atthe receiver is divided into two pars : 1. ‘The part containing empty locations. 2. The part containing the received bytes which can be ‘consumed by the sending process. 6.14.4 Bytes and Segments Buffering i used to handle the difference between the speed of data transmission and data consumption. But only buffering is not enough. We need one more step before sending the data. ‘The IP layer, which provides service to TCP, has to send data {n the form of packets instead of stream of bytes [At the transport layer, TCP group a numberof byes to form ‘packet called a segment. ‘A header is added to each segment for the purpose of exercising control. ‘Sending TOP. (G2 Fig. 6143 ‘The segments are not of the same size. Each segment can camry hundreds of bytes. 6.14.5 Full Duplex Servic = TCP offers full duplex service where the data can flow in both the directions simultaneously. Each TCP will then have a sending buffer and receiving buffer. The TCP segments can travel in both the directions, ‘therefore TCP provides a full duplex service. 6.14.6 Connection Oriented Service : = TCP is a connection oriented protocol. When process — 1 wants to communicate (send and receive) with another process (process - 2), the sequence of operations is as follows L. TCP of process ~ 1 informs TCP of process ~ 2 and. create a connection between them. 2, TCP of process ~ 1 and TCP of process ~ 2 exchange

You might also like