chap 11 modified pp2003

Upload: yazanalomari

Post on 13-Apr-2018

233 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Chap 11 Modified PP2003

    1/36

    TCP/IP Protocol Suite 1

    Chapter 11Chapter 11

    Upon completion you will be able to:

    User DatagramUser DatagramProtocolProtocol

    Be able to explain process-to-process communication

    Know the format of a UDP user datagram

    Be able to calculate a UDP checksum

    Understand the operation of UDP

    Know when it is appropriate to use UDP

    Understand the modules in a UDP package

    Objectives

  • 7/25/2019 Chap 11 Modified PP2003

    2/36

    TCP/IP Protocol Suite 2

    Figure 11.1 Position of UDP in the TP!"P protocol suite

  • 7/25/2019 Chap 11 Modified PP2003

    3/36

    TCP/IP Protocol Suite 3

    11.1 PROCESS-TO-PROCESS

    COMMUNICATION

    Before we examine UDP# we must first understand host-to-hostBefore we examine UDP# we must first understand host-to-hostcommunication and process-to-process communication and thecommunication and process-to-process communication and the

    difference between them$difference between them$

    The topics discussed in this section include:The topics discussed in this section include:

    Port %umbersPort %umbers

    &ocket 'ddresses&ocket 'ddresses

  • 7/25/2019 Chap 11 Modified PP2003

    4/36

    TCP/IP Protocol Suite 4

    Figure 11.2 UDP (ersus "P

    UDP (User Datagram Protocol) creates atransport layer connection between two

    processes.

    user !atagram is encapsulate! in an IP!atagram.

    The port number i!enti"es the process# orrunning application program. So using the pnumber# UDP !irects the pac$et to the correctlocation.

    UDP !oes little else. %o &ow control. %o ac$o' receie! pac$ets. nly error control is i'a chec$sum error is !etecte!# it *uietly !rops

    the pac$et.

  • 7/25/2019 Chap 11 Modified PP2003

    5/36

    TCP/IP Protocol Suite 5

    Figure 11.2 UDP (ersus "P

    UDP is a connectionless# unreliable transportprotocol.

    It !oes not a!! anything to the serices o' IPe+cept 'or proi!ing process,to,processcommunication# instea! o' host,to,host.

    !antages- inimal oerhea! 'aster

    UDP wor$s well with apps that hae their ownerror an! &ow control wor$s well withmulticasting# S%P# T0TP (triial 0TP)#(but not 0TP)# an! IP.

  • 7/25/2019 Chap 11 Modified PP2003

    6/36

    TCP/IP Protocol Suite 6

    Figure 11.2 UDP (ersus "P

    0or communication# 2 pieces o' in'o are nee!e!3

    1.local host (IP a!!r)# 4.local process (port 5)#6.remote host (IP a!!r)# 2. remote process (port 5).7ocal process port 5 can be 8ust about any number(between 9 an! :;#;6;)# but remote process port 5has

    to be "+e!# otherwise who woul! $now what it is-

  • 7/25/2019 Chap 11 Modified PP2003

    7/36

    TCP/IP Protocol Suite 7

    Figure 11.3 Port numbers

  • 7/25/2019 Chap 11 Modified PP2003

    8/36

    TCP/IP Protocol Suite 8

    Figure 11.4 "P addresses (ersus port numbers

  • 7/25/2019 Chap 11 Modified PP2003

    9/36

    ICANN ranges

    Well-known ports 0 -> 1023 (assigne an !ontrolle "# ICANN$%

    &egistere ports 1024 -> 4'151 &egistere wit ICANN to pre)ent *pli!ation%

    +#na,i! ports

    4'152 -> 65535 e# !an "e *se as te,porar# or pri)ate port

    n*,"ers%

    TCP/IP Protocol Suite '

  • 7/25/2019 Chap 11 Modified PP2003

    10/36

    TCP/IP Protocol Suite 10

    Figure 11.5 "'%% ranges

  • 7/25/2019 Chap 11 Modified PP2003

    11/36

    TCP/IP Protocol Suite 11

    Table ))$)Table ))$) *ell-known ports used with UDP*ell-known ports used with UDP

    >ell,$nown port 5s are ? 1942.

  • 7/25/2019 Chap 11 Modified PP2003

    12/36

    TCP/IP Protocol Suite 12

    Figure 11.6 &ocket address

    In Uni+# the socket addressis the combination o'IP a!!ress an! UDP/TCP port number.

  • 7/25/2019 Chap 11 Modified PP2003

    13/36

    TCP/IP Protocol Suite 13

    11.2 USER DATAGRAM

    UDP packets are called user datagrams and ha(e a fixed-si+e header of ,UDP packets are called user datagrams and ha(e a fixed-si+e header of ,bytes$bytes$

  • 7/25/2019 Chap 11 Modified PP2003

    14/36

    TCP/IP Protocol Suite 14

    Figure 11.7 User datagram format

  • 7/25/2019 Chap 11 Modified PP2003

    15/36

    TCP/IP Protocol Suite 15

    UDP length "P length . "P header/s length

    Note:Note:

  • 7/25/2019 Chap 11 Modified PP2003

    16/36

    .+/ pro)ies a connectionless service. Thismeans that each *ser atagra, sent "#.+/ is an inepenent atagra,%

    ere is no relationsip "etween teierent *ser atagra,s e)en i te# are!o,ing ro, te sa,e so*r!e pro!ess angoing to te sa,e estination progra,%

    e *ser atagra,s are not n*,"ere%

    TCP/IP Protocol Suite 16

  • 7/25/2019 Chap 11 Modified PP2003

    17/36

    TCP/IP Protocol Suite 17

    11.3 CHECKSUM

    UDP checksum calculation is different from the one for "P and "0P$UDP checksum calculation is different from the one for "P and "0P$1ere the checksum includes three sections: a pseudoheader# the UDP1ere the checksum includes three sections: a pseudoheader# the UDP

    header# and the data coming from the application layer$header# and the data coming from the application layer$

    The topics discussed in this section include:The topics discussed in this section include:

    hecksum alculation at &enderhecksum alculation at &ender

    hecksum alculation at 2ecei(erhecksum alculation at 2ecei(er

    3ptional Use of the hecksum3ptional Use of the hecksum

  • 7/25/2019 Chap 11 Modified PP2003

    18/36

    TCP/IP Protocol Suite 18

    Figure 11.8 Pseudoheader for checksum calculation

    Psue!ohea!er an! pa!!ing are only use! to calculatchec$sum. 'ter chec$sum is calculate!# they are

    !roppe!.

  • 7/25/2019 Chap 11 Modified PP2003

    19/36

    TCP/IP Protocol Suite 1'

    Figure 11.9 hecksum calculation of a simple UDP user datagram

  • 7/25/2019 Chap 11 Modified PP2003

    20/36

    ptional *se o te

    !e!ks*, I te !e!ks*, is not !al!*late teel is lle wit 0s%

    I te so*r!e oes !al!*late te!e!ks*, an te res*lt appens to"e all 0s it ,*st "e !o,ple,ente(1s$%

    TCP/IP Protocol Suite 20

  • 7/25/2019 Chap 11 Modified PP2003

    21/36

    TCP/IP Protocol Suite 21

    11.4 UDP OPERATION

    UDP uses concepts common to the transport layer$ These concepts willUDP uses concepts common to the transport layer$ These concepts willbe discussed here briefly# and then expanded in the next chapter on thebe discussed here briefly# and then expanded in the next chapter on the

    TP protocol$TP protocol$

    The topics discussed in this section include:The topics discussed in this section include:

    onnectionless &er(icesonnectionless &er(ices

    4low and 5rror ontrol4low and 5rror ontrol

    5ncapsulation and Decapsulation5ncapsulation and Decapsulation

    6ueuing6ueuing

    0ultiplexing and Demultiplexing0ultiplexing and Demultiplexing

  • 7/25/2019 Chap 11 Modified PP2003

    22/36

    TCP/IP Protocol Suite 22

    Figure 11.10 5ncapsulation and decapsulation

  • 7/25/2019 Chap 11 Modified PP2003

    23/36

    TCP/IP Protocol Suite 23

    Figure 11.11 6ueues in UDP

  • 7/25/2019 Chap 11 Modified PP2003

    24/36

    Multiplexing and demultiplexingmultiplexing

    At te sener site tere ,a# "e se)eral pro!essestat nee to sen *ser atagra,s% owe)ertere is onl# one .+/% is is a ,an#-to-onerelationsip an re*ires ,*ltipleing %

    Demultiplexing

    At te re!ei)er site tere is onl# one .+/% owe)erwe ,a# a)e ,an# pro!esses tat !an re!ei)e

    *ser atagra,s% is is a one-to-,an#relationsip an re*ires e,*ltipleing%

    TCP/IP Protocol Suite 24

  • 7/25/2019 Chap 11 Modified PP2003

    25/36

    TCP/IP Protocol Suite 25

    Figure 11.12 0ultiplexing and demultiplexing

  • 7/25/2019 Chap 11 Modified PP2003

    26/36

    TCP/IP Protocol Suite 26

    11.5 USE OF UDP

    -UDP is suitable for a process that re7uires simple re7uest-responseUDP is suitable for a process that re7uires simple re7uest-responsecommunication with little concern for flow and error control$communication with little concern for flow and error control$

    -UDP is suitable for a process with internal flow and error-controlUDP is suitable for a process with internal flow and error-control

    mechanisms 8T4TP9$mechanisms 8T4TP9$

    -UDP is suitable transport protocol for multicasting$UDP is suitable transport protocol for multicasting$

    -

    UDP is used for management processes such as &%0P$UDP is used for management processes such as &%0P$

    -UDP is used for some route updating protocols such as 2"P$UDP is used for some route updating protocols such as 2"P$

  • 7/25/2019 Chap 11 Modified PP2003

    27/36

    TCP/IP Protocol Suite 27

    11.6 UDP PACKAGE

    To show how UDP handles the sending and recei(ing of UDP packets#To show how UDP handles the sending and recei(ing of UDP packets#we present a simple (ersion of the UDP package$ The UDP packagewe present a simple (ersion of the UDP package$ The UDP package

    in(ol(es fi(e components: a control-block table# input 7ueues# a control-in(ol(es fi(e components: a control-block table# input 7ueues# a control-

    block module# an input module# and an output module$block module# an input module# and an output module$

    The topics discussed in this section include:The topics discussed in this section include:

    ontrol-Block Tableontrol-Block Table

    "nput 6ueues"nput 6ueuesontrol-Block 0oduleontrol-Block 0odule

    "nput 0odule"nput 0odule

    3utput 0odule3utput 0odule

    Fi 11 13 UDP d i

  • 7/25/2019 Chap 11 Modified PP2003

    28/36

    TCP/IP Protocol Suite 28

    Figure 11.13 UDP design

    Fi 11 13 UDP d i

  • 7/25/2019 Chap 11 Modified PP2003

    29/36

    TCP/IP Protocol Suite 2'

    Figure 11.13 UDP design

    Control,bloc$ table , $eeps trac$ o' the open ports.Table entries inclu!e state ('ree or in,use)# processID# port number# an! correspon!ing *ueue number.

    Control,bloc$ mo!ule , manages the entries in thecontrol,bloc$ table. >hen a process starts# it as$s 'oPort number 'rom the operating system.

    Input mo!ule , accepts a user !atagram 'rom the IPan! chec$s to see i' there is an e+isting port entryin table. I' yes# *ueue re*uest i' no# generateICP error message.

    utput mo!ule , creates an! sen!s user !atagrams.

  • 7/25/2019 Chap 11 Modified PP2003

    30/36

    TCP/IP Protocol Suite 30

    Table ))$Table ))$ The control-block table at the beginning of examplesThe control-block table at the beginning of examples

    7et@s loo$ at some e+amples. Aelow is the control,bloc$table be'ore the e+amples.

  • 7/25/2019 Chap 11 Modified PP2003

    31/36

    TCP/IP Protocol Suite 31

    The first acti(ity is the arri(al of a user datagram with

    destination port number ;#

  • 7/25/2019 Chap 11 Modified PP2003

    32/36

    TCP/IP Protocol Suite 32

    'fter a few seconds# a process starts$ "t asks the operatingsystem for a port number and is granted port number ;#$

    %ow the process sends its "D 8>#?@,9 and the port number to

    the control-block module to create an entry in the table$ The

    module takes the first 4255 entry and inserts the information

    recei(ed$ The module does not allocate a 7ueue at this moment

    because no user datagrams ha(e arri(ed for this destination

    8see Table ))$=9$

    Example3

    See Next Slide

  • 7/25/2019 Chap 11 Modified PP2003

    33/36

    TCP/IP Protocol Suite 33

    Table ))$=Table ))$= ontrol-block table after 5xample =ontrol-block table after 5xample =

  • 7/25/2019 Chap 11 Modified PP2003

    34/36

    TCP/IP Protocol Suite 34

    ' user datagram now arri(es for port ;#=9$ &ee Table ))$>$

    Example4

    See Next Slide

  • 7/25/2019 Chap 11 Modified PP2003

    35/36

    TCP/IP Protocol Suite 35

    Table ))$>Table ))$> ontrol-block after 5xample >ontrol-block after 5xample >

  • 7/25/2019 Chap 11 Modified PP2003

    36/36

    TCP/IP Protocol Suite 36

    'fter a few seconds# a user datagram arri(es for port ;#$

    The input module checks the table and cannot find an entry for

    this destination$ The user datagram is dropped and a re7uest is

    made to "0P to send an Aunreachable port message to the

    source$

    Example5