User Datagram protocol For Msc CS

30
1 1 User Datagram Protocol (UDP)

Transcript of User Datagram protocol For Msc CS

Page 1: User Datagram protocol For Msc CS

11

User DatagramProtocol(UDP)

Page 2: User Datagram protocol For Msc CS

22

UDP is a communications protocol that offers a l imited amount of service when messages are exchanged between computers in a network that uses the Internet Protocol (IP). UDP is an alternative to the Transmission Control Protocol (TCP) and, together with IP, is sometimes referred to as UDP/IP. Like the Transmission Control Protocol, UDP uses the Internet Protocol to actually get a data unit (called a datagram) from one computer to another.

Unlike TCP, however, UDP does not provide the service of dividing a message into packets (datagrams) and reassembling it at the other end. Specif ically, UDP doesn't provide sequencing of the packets that the data arrives in. This means that the application program that uses UDP must be able to make sure that the entire message has arrived and is in the right order. Network applications that want to save processing t ime because they have very small data units to exchange (and therefore very l i t t le message reassembling to do) may prefer UDP to TCP. The Trivial File Transfer Protocol (TFTP) uses UDP instead of TCP.

Page 3: User Datagram protocol For Msc CS

33

The User Datagram Protocol (UDP) is one of the core members of the Internet protocol suite (the set of network protocols used for the Internet). With UDP, computer applications can send messages, in this case referred to as datagrams, to other hosts on an Internet Protocol (IP) network without prior communications to set up special transmission channels or data paths. The protocol was designed by David P. Reed in 1980 and formally defined in RFC 768.

Page 4: User Datagram protocol For Msc CS

44

Page 5: User Datagram protocol For Msc CS

55

Page 6: User Datagram protocol For Msc CS

66

UDP is located between the application layer and the IP layer, and serves as the intermediary between the application programs and the network operations.

Page 7: User Datagram protocol For Msc CS

77

Figure 14.1 Position of UDP in the TCP/IP protocol suite

Page 8: User Datagram protocol For Msc CS

88

ApplicationsNumerous key Internet applications use UDP, including: the Domain Name System (DNS), where queries must be fast and only consist of a single request followed by a single reply packet, the Simple Network Management Protocol (SNMP), the Routing Information Protocol (RIP) [2] and the Dynamic Host Configuration Protocol (DHCP).

Voice and video traff ic is generally transmitted using UDP

many businesses are finding that a recent increase in UDP traff ic from these real-t ime applications is hindering the performance of applications using TCP, such as point of sale, accounting, and database systems. When TCP detects packet loss,

Page 9: User Datagram protocol For Msc CS

99

USER DATAGRAM

UDP packets, called user datagrams, have a f ixed-size header of 8 bytes.

Page 10: User Datagram protocol For Msc CS

1010

The following is a dump of a UDP header in hexadecimal format.

a. What is the source port number?b. What is the destination port number?c. What is the total length of the user datagram?d. What is the length of the data?f. What is the client process?

Example

Page 11: User Datagram protocol For Msc CS

1111

Solutiona. The source port number is the f irst four

hexadecimal digits (CB84) 16 or 52100.

b. The destination port number is the second four hexadecimal digits (000D) 16 or 13.

c. The third four hexadecimal digits (001C) 16 define the length of the whole UDP packet as 28 bytes.

d. The length of the data is the length of the whole packetminus the length of the header, or 28 – 8 = 20 bytes.

f. The client process is the Daytime (see Table 14.1).

Page 12: User Datagram protocol For Msc CS

1212

Page 13: User Datagram protocol For Msc CS

1313

Encapsulation and decapsulation

Page 14: User Datagram protocol For Msc CS

1414

Queues in UDP

Page 15: User Datagram protocol For Msc CS

TCP/IP Protocol SuiteTCP/IP Protocol Suite 1515

Multiplexing and demultiplexing

Page 16: User Datagram protocol For Msc CS

1616

UDP is an example of the connectionless simple protocol with the

exception of an optional checksum added to packets for error detection.

Note

Page 17: User Datagram protocol For Msc CS

1717

A client-server application such as DNS uses the services of UDP because a client needs to send a short request to a server and to receive a quick response from it . The request and response can each f it in one user datagram. Since only one message is exchanged in each direction, the connectionless feature is not an issue; the client or server does not worry that messages are delivered out of order.

Why UDP?

Page 18: User Datagram protocol For Msc CS

1818

A client-server application such as SMTP which is used in electronic mail, cannot use the services of UDP because a user can send a long e-mail message, which may include mult imedia ( images, audio, or video). If the application uses UDP and the message does not f i t in one single user datagram, the message must be split by the application into dif ferent user datagrams. Here the connectionless service may create problems. The user datagrams may arrive and be delivered to the receiver application out of order. The receiver application may not be able to reorder the pieces. This means the connectionless service has a disadvantage for an application program that sends long messages.

Page 19: User Datagram protocol For Msc CS

1919

Assume we are downloading a very large text f i le from the Internet. We definitely need to use a transport layer that provides reliable service. We don’t want part of the f i le to be missing or corrupted when we open the f i le. The delay created between the delivery of the parts are not an overriding concern for us; we wait unti l the whole f i le is composed before looking at it . In this case, UDP is not a suitable transport layer.

Page 20: User Datagram protocol For Msc CS

2020

UDP PACKAGE

To show how UDP handles the sending and receiving of UDP packets, we present a simple version of the UDP package. We can say that the UDP package involves five components: a control-block table, input queues, a control-block module, an input module, and an output module.

Page 21: User Datagram protocol For Msc CS

TCP/IP Protocol SuiteTCP/IP Protocol Suite 2121

UDP design

Page 22: User Datagram protocol For Msc CS

2222

Page 23: User Datagram protocol For Msc CS

2323

Page 24: User Datagram protocol For Msc CS

2424

Page 25: User Datagram protocol For Msc CS

2525

Page 26: User Datagram protocol For Msc CS

2626

The first activity is the arrival of a user datagram with destination port number 52,012. The input module searches for this port number and finds it. Queue number 38 has been assigned to this port, which means that the port has been previously used. The input module sends the data to queue 38. The control-block table does not change.

After a few seconds, a process starts. It asks the operating system for a port number and is granted port number 52,014. Now the process sends its ID (4,978) and the port number to the control-block module to create an entry in the table. The module takes the first FREE entry and inserts the information received. The module does not allocate a queue at this moment because no user datagrams have arrived for this destination (see Table 14.6).A user datagram now arrives for port 52,011. The input module checks the table and f inds that no queue has been al located for this destination since this is the f irst t ime a user datagram has arrived for this destination. The module creates a queue and gives it a number (43). See Table 14.7.

After a few seconds, a user datagram arrives for port 52,222. The input module checks the table and cannot f ind an entry for this destination. The user datagram is dropped and a request is made to ICMP to send an unreachable port message to the source.

Page 27: User Datagram protocol For Msc CS

2727

Page 28: User Datagram protocol For Msc CS

2828

Reliabil i ty and congestion control solutions

Lacking reliabil i ty, UDP applications must generally be wil l ing to accept some loss, errors or duplication. Some applications, such as TFTP, may add rudimentary reliabil i ty mechanisms into the application layer as needed.

Most often, UDP applications do not employ rel iabil i ty mechanisms and may even be hindered by them. Streaming media, real-t ime multiplayer games and voice over IP (VoIP) are examples of applications that often use UDP. In these particular applications, loss of packets is not usually a fatal problem. If an application requires a high degree of reliabil i ty, a protocol such as the Transmission Control Protocol may be used instead.

Page 29: User Datagram protocol For Msc CS

2929

Page 30: User Datagram protocol For Msc CS

3030

Thanvi