chapter 11 使用者資料包通訊協定
DESCRIPTION
Chapter 11 使用者資料包通訊協定. 目標. 本章結束後,您將能夠: 可以去說明程序對程序的通訊 知道 UDP 使用者資料包的格式 可以去計算 UDP 的檢查碼 了解 UDP 的運作 知道 使用 UDP 的時機 了解 UDP 套件中的各模組. 11.1 程序對程序的通訊. 在仔細看 UDP 之前,我們先要了解 主機對主機的通訊 ( host-to-host communication ) 與 程序對程序的通訊 ( process-to-process communication ) ,以及它們之間有何不同。. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/1.jpg)
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
Chapter 11使用者資料包通訊協定
![Page 2: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/2.jpg)
11 - 2
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
目標
本章結束後,您將能夠: 可以去說明程序對程序的通訊 知道 UDP 使用者資料包的格式 可以去計算 UDP 的檢查碼 了解 UDP 的運作 知道使用 UDP 的時機 了解 UDP 套件中的各模組
![Page 3: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/3.jpg)
11 - 3
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 4: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/4.jpg)
11 - 4
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.1 程序對程序的通訊 在仔細看 UDP 之前,我們先要了解主機對主機的通訊 ( host-to-host communication ) 與程序對程序的通訊 ( process-to-process communication ) ,以及它們之間有何不同。
本節所討論的主題包括: 通訊埠號碼 插座位址
![Page 5: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/5.jpg)
11 - 5
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 6: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/6.jpg)
11 - 6
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 7: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/7.jpg)
11 - 7
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 8: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/8.jpg)
11 - 8
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 9: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/9.jpg)
11 - 9
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
公認埠的號碼皆小於 1024 。
請注意:請注意:
![Page 10: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/10.jpg)
11 - 10
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 11: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/11.jpg)
11 - 11
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 1
在 UNIX 系統中,公認埠號被儲存在 /etc/services 的這個檔案中。檔案中的每一行給予某個服務的名稱及對應的公認埠號。我們可以使用 grep 的系統工具來擷取指定應用所對應的那一行或多行的資料。下面顯示 TFTP 的埠號,注意 TFTP 可以使用 UDP 或 TCP 服務的 69 埠號。
接下一張投影片
![Page 12: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/12.jpg)
11 - 12
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 1 ( 續 )
SNMP 通訊協定使用兩個埠號 ( 161 和 162 ) ,來針對不同的目的,我們會在第 21 章討論。
![Page 13: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/13.jpg)
11 - 13
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 14: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/14.jpg)
11 - 14
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.2 使用者資料包 UDP 的封包被稱為使用者資料包 ( user datagram ) ,它的標頭固定為 8 個位元組。
![Page 15: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/15.jpg)
11 - 15
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 16: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/16.jpg)
11 - 16
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
UDP 長度= IP 長度- IP 標頭長度
請注意:請注意:
![Page 17: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/17.jpg)
11 - 17
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.3 檢查碼 UDP 的檢查碼計算與 IP 或 ICMP 不同, UDP 的檢查碼計算包含了三個部份:一個虛擬標頭 ( pseudoheader ) 、 UDP 標頭及來自應用層的資料。
本節所討論的主題包括: 傳送端檢查碼之計算 接收端檢查碼之計算 UDP 可以使用檢查碼也可以不使用
![Page 18: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/18.jpg)
11 - 18
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 19: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/19.jpg)
11 - 19
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 20: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/20.jpg)
11 - 20
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.4 UDP 的運作 UDP 使用的概念與傳輸層共通,在這一節,我們會先簡單介紹,待下一章 TCP 通訊協定再詳細介紹。
本節所討論的主題包括: 非預接式服務 流量與錯誤控制 封裝及拆裝 佇列 多工與解多工
![Page 21: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/21.jpg)
11 - 21
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 22: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/22.jpg)
11 - 22
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 23: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/23.jpg)
11 - 23
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 24: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/24.jpg)
11 - 24
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.5 UDP 之用途 在本節中,我們討論一些使用 UDP 通訊協定的地方。
![Page 25: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/25.jpg)
11 - 25
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
11.6 UDP 套件 為了去說明 UDP 如何處理 UDP 封包的傳送與接收動作,我們展示一個簡易版本的 UDP 套件。 UDP 套件包含下面五個模組:控制區塊表 ( control-block table ) 、輸入佇列 ( input queue ) 、控制區塊模組 ( control-block module ) 、輸入模組 ( input module ) 及輸出模組 ( output module ) 。
本節所討論的主題包括: 控制區塊表 輸入佇列 控制區塊模組 輸入模組 輸出模組
![Page 26: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/26.jpg)
11 - 26
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 27: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/27.jpg)
11 - 27
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 28: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/28.jpg)
11 - 28
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 2 一開始一個目的埠號為 52,012 的使用者資料包到來。 輸入模組在控制區塊表中尋找並找到這個埠號,同時知道
這個埠已經使用,佇列代碼為 38 。 輸入模組將使用者資料包傳送到 38 號佇列,控制區塊表
保持不變。
![Page 29: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/29.jpg)
11 - 29
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 3
接下一張投影片
在數秒後,一個程序啟動,它向作業系統要求一個埠號,而作業系統給予此程序一個 52,014 的埠號。
然後該程序將其程序代碼 ( 4,978 ) 及埠號交給控制區塊模組,以便在控制區塊表中建立一個條目。
控制模組選用第一個空著的條目,把收到的資訊填入。此時並沒有建立相對應的佇列,因為到此目的埠的使用者資料包還沒有到來 ( 見表 11.3 ) 。
![Page 30: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/30.jpg)
11 - 30
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 31: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/31.jpg)
11 - 31
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 4
接下一張投影片
一個目的埠為 52,011 的使用者資料包傳送進來。 輸入模組檢查表中發現目前並沒有為這個目的埠安排佇列,
這是因為到這個埠號的第一個資料包現在才到。 這時候輸入模組便建立一個佇列,其代碼為 43 ( 見表 11.
4 ) 。
![Page 32: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/32.jpg)
11 - 32
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
![Page 33: Chapter 11 使用者資料包通訊協定](https://reader030.vdocuments.mx/reader030/viewer/2022020714/568137ea550346895d9f9efd/html5/thumbnails/33.jpg)
11 - 33
© The McGraw-Hill Companies, Inc., 2006© The McGraw-Hill Companies, Inc., 2007
範例 5
數秒後,一個埠號為 52,222 的使用者資料包傳送進來。 輸入模組在表中無法找到一個與此埠號一樣的條目,於是
該使用者資料包就被丟棄。 同時輸入模組要求 ICMP 送出一個通訊埠無法到達的訊
息給資料包的來源端。