User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP •...

27
©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl , 2003 1 1 Chapter 11 User Datagram Protocol (UDP)

Transcript of User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP •...

Page 1: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200311

Chapter 11

User DatagramProtocol(UDP)

Page 2: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200322

CONTENTSCONTENTS

• PROCESS-TO-PROCESS COMMUNICATION• USER DATAGRAM• CHECKSUM• UDP OPERATION• USE OF UDP• UDP PACKAGE

Page 3: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200333

Position of UDP in the TCP/IP protocol suite

Page 4: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200344

UDP Services• Process-to-process communication using “Ports.”

Fundamentally, this is the only thing it adds on top of IP.• Control:

– No flow control or acknowledgment– Minimal error control: simply detect and drop.

• No Segmentation/Reassembly service. Incoming data must fit in a UDP packet.

• Connectionless & Unreliable transport.• Minimal overhead, compared to TCP

Page 5: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200355

PROCESS TO PROCESS COMMUNICATION11.111.1

UDP versus IP

Page 6: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200366

Client-Server Paradigm & Ports• A Client process on a local host sends a request to a Server process on a

remote host.• Client process identification:

– Local host IP– Ephemeral port number (0-65,535) randomly chosen by UDP

• Server process identification– Remote host IP– Well-known port number

Page 7: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200377

Role of IP addresses vs. Port numbers

Page 8: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200388

IANA Port Number Ranges

Simple Network Management ProtocolSNMP161Network Time ProtocolNTP123Remote procedure callRPC111Returns the date and timeDaytime13Echoes a received datagram back to senderEcho7

DescriptionProtocolPort

Page 9: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 200399

Socket addresses

UDP HeaderUDP HeaderIP HeaderIP Header

Page 10: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031010

UDP Packets or User Datagram11.211.2

Max UDP Data length = 65535 - UDP Header (8) - Smallest IP header(20) = 65,507

Page 11: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031111

Checksum11.311.3

• Checksum covers three sections:1. Pseudoheader (which does not physically exist as part of the

user datagram)2. UDP header3. Data coming from Application Layer whose length must be

an even number of Bytes. Padding may be added to help compute the checksum, then eliminated be.

Page 12: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031212

Pseudoheader added to the UDP datagram

Page 13: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031313

Checksum calculation of a simple UDP user datagram

Page 14: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031414

UDP Operation11.411.4

• Its Connectionless:– Independent user datagrams, even if from same source

socket to same destination socket. No streaming is supported.

– Data must be small enough to fit in one user datagram.• No flow or error control

– If checksum fail, destination silently drops the datagram.– Source gets no idea whether the user datagram has arrived.

Page 15: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031515

Encapsulation and decapsulation

+ pair of sockets+ pair of sockets+ data length+ data length

Protocol = Protocol = 1717 + Sender/Receiver IP+ Sender/Receiver IP

+ sender’s socket+ sender’s socket

Page 16: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031616

Queues in UDP

Page 17: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031717

Multiplexing and demultiplexing

Page 18: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031818

Use of UDP11.511.5

• Simple request-response communication (no bulk data)• Processes with Internal flow and error-control mechanisms

(e.g. Trivial FTP).• Multicasting and Broadcasting• Management processes (e.g. SNMP)• Routing Information Protocol (RIP) for route updating.

Page 19: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20031919

UDP Package11.611.6

Page 20: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032020

ExamplesControl-block table at the beginning

StateState Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

---------------- ------------------------ ---------------------------- ------------------------------------

IN-USE 2,345 52,010 34

IN-USE 3,422 52,011

FREE

IN-USE 4,652 52,012 38

FREE

Page 21: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032121

Example 1Example 1

The first activity is the arrival of a user

Page 22: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032222

Example 2Example 2

After a few seconds, a process starts. It asks

Page 23: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032323

Modified table after Example 2StateState Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

---------------- ------------------------ ---------------------------- ------------------------------------

IN-USE 2,345 52,010 34

IN-USE 3,422 52,011

IN-USE 4,978 52,014

IN-USE 4,652 52,012 38

FREE

Page 24: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032424

Example 3Example 3

A user datagram now arrives for port 52,011.

Page 25: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032525

Modified table after Example 3StateState Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

---------------- ------------------------ ---------------------------- ------------------------------------

IN-USE 2,345 52,010 34

IN-USE 3,422 52,011 43

IN-USE 4,978 52,014

IN-USE 4,652 52,012 38

FREE

Page 26: User Datagram Protocol (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032626

Example 4Example 4

After a few seconds, a user datagram arrives for port 52,222. The input module checks the table and cannot find the 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 (UDP) - JMU...– Ephemeral port number (0-65,535) randomly chosen by UDP • Server process identification – Remote host IP

©The McGraw-Hill Companies, Inc., 2000 © Adapted for use at JMU by Mohamed Aboutabl, 20032727

Example 5Example 5

After a few seconds, a process needs to send a user datagram. It delivers the data to the output module which adds the UDP header and sends it.