12 · Explaining the TCP_IP Transport Layer and Application Layer說明 TCP/IP 傳輸層與應用層

TCP CharacteristicsTCP 特性

Applications use the connection-oriented services of TCP to provide data reliability between hosts. TCP includes several important features that provide reliable data transmission.

應用程式使用 TCP 的連線導向服務,以在主機之間提供資料可靠性。TCP 包含多項重要功能,可提供可靠的資料傳輸。

TCP can be characterized as follows:

TCP 的特性可歸納如下:

  • TCP operates at the transport layer of the TCP/IP stack (OSI Layer 4).TCP 在 TCP/IP 堆疊的傳輸層運作(OSI 第 4 層)。
  • TCP provides application access to the Internet layer (OSI Layer 3, the network layer), where application data is routed from the source IP host to the destination IP host.TCP 讓應用程式能存取網際網路層(OSI 第 3 層,即網路層),在此層中應用程式資料會從來源 IP 主機路由至目的 IP 主機。
  • TCP is connection-oriented and requires that network devices set up a connection to exchange data. The end systems synchronize with one another to manage packet flows and adapt to congestion in the network.TCP 是連線導向的,需要網路裝置建立連線才能交換資料。端點系統會彼此同步,以管理封包流並適應網路中的壅塞情況。
  • TCP provides error checking by including a checksum in the TCP segment to verify that the TCP header information is not corrupt.TCP 透過在 TCP 區段中加入檢查碼來提供錯誤檢查,以驗證 TCP 標頭資訊沒有損毀。
  • TCP establishes two connections between the source and destination. The pair of connections operates in full-duplex mode, one in each direction. These connections are often called a virtual circuit because, at the transport layer, the source and destination do not know about the network.TCP 在來源端與目的端之間建立兩個連線。這對連線以全雙工模式運作,各自負責一個方向。這些連線常被稱為虛擬電路,因為在傳輸層中,來源端與目的端並不了解網路的實際情況。
  • TCP segments are numbered and sequenced so that the destination can reorder segments and determine if data is missing or arrives out of order.TCP 區段會被編號並排序,讓目的端能重新排列區段,並判斷資料是否遺失或順序錯誤。
  • Upon receipt of one or more TCP segments, the receiver returns an acknowledgment to the sender to indicate that it received the segment. Acknowledgments form the basis of reliability within the TCP session. When the source receives an acknowledgment, it knows that the data has been successfully delivered. If the source does not receive an acknowledgment within a predetermined period, it retransmits that data to the destination. The source may also terminate the connection if it determines that the receiver is no longer connected.接收端收到一個或多個 TCP 區段後,會回傳確認訊息給傳送端,表示已收到該區段。確認訊息構成了 TCP 工作階段可靠性的基礎。當來源端收到確認訊息時,就知道資料已成功送達。若來源端在預定時間內未收到確認訊息,便會將該資料重新傳送給目的端。若來源端判斷接收端已不再連線,也可能終止該連線。
  • TCP provides mechanisms for flow control. Flow control assists the reliability of TCP transmission by adjusting the effective rate of data flow between the two services in the session.TCP 提供流量控制機制。流量控制透過調整工作階段中兩端服務之間的實際資料流速率,協助提升 TCP 傳輸的可靠性。

Reliable data delivery services are critical for applications such as file transfers, database services, transaction processing, and other applications in which delivery of every packet must be guaranteed. TCP segments are sent by using IP packets. The TCP header follows the IP header and supplies information that is specific to the TCP protocol. Flow control, reliability, and other TCP characteristics are achieved by using fields in the TCP header. Each field has a specific function.

可靠的資料傳遞服務,對於檔案傳輸、資料庫服務、交易處理,以及其他任何必須保證每個封包都送達的應用程式來說,都是不可或缺的。TCP 區段是利用 IP 封包傳送的。TCP 標頭緊接在 IP 標頭之後,提供 TCP 協定專屬的資訊。流量控制、可靠性以及其他 TCP 特性,都是透過 TCP 標頭中的欄位來實現,每個欄位都有其特定功能。

The TCP header is a minimum of 20 bytes; the fields in the TCP header are as follows:

TCP 標頭最少為 20 位元組,TCP 標頭中的欄位如下:

  • Source Port: Calling port number (16 bits)來源連接埠:撥號連接埠號(16 位元)
  • Destination Port: Called port number (16 bits)目的連接埠:被叫連接埠號(16 位元)
  • Sequence Number and Acknowledgment Number: Used for reliability and congestion avoidance (32 bits each)序號 與確認號:用於可靠性與壅塞避免(各 32 位元)
  • Header Length: Size of the TCP header (4 bits)標頭長度:TCP 標頭的大小(4 位元)
  • Reserved: For future use (3 bits)保留:供未來使用(3 位元)
  • Flags: Or control bits (9 bits)旗標:又稱控制位元(9 位元)
    • Nonce Sum (NS): Enables the receiver to demonstrate to the sender that segments are being acknowledged隨機數總和(NS):讓接收端能向傳送端證明區段已被確認
    • Congestion Window Reduced (CWR): Acknowledges that the congestion-indication echoing was received壅塞視窗縮減(CWR):確認已收到壅塞指示回應
    • Explicit Congestion Notification Echo (ECE): Indication of congestion明確壅塞通知回應(ECE):壅塞的指示
    • Urgent (URG): Data that should be prioritized over other data緊急(URG):應優先於其他資料處理的資料
    • Acknowledgment (ACK): Used for acknowledgment確認(ACK):用於確認
    • Push (PSH): Indicates that application data should be transmitted immediately and not wait for the entire TCP segment推送(PSH):指示應用程式資料應立即傳輸,不需等待整個 TCP 區段填滿
    • Reset (RST): Indicates that the connection should be reset重設(RST):指示應重設該連線
    • Synchronize (SYN): Synchronize sequence numbers同步(SYN):同步序號
    • Finish (FIN): Indicates that there is no more data from sender結束(FIN):指示傳送端已無更多資料要傳送
  • Window size: Window size value, used for flow control (16 bits)視窗大小:視窗大小數值,用於流量控制(16 位元)
  • Checksum: Calculated checksum from a constructed pseudo header (containing the source address, destination address, and protocol from the IP header, TCP segment length, and reserved bits), and the TCP segment (TCP header and payload) for error checking (16 bits)檢查碼:根據建構的偽標頭(包含來源位址、目的位址、IP 標頭中的協定欄位、TCP 區段長度與保留位元)以及 TCP 區段(TCP 標頭與承載資料)計算出的檢查碼,用於錯誤檢查(16 位元)
  • Urgent Pointer: If the URG flag is set, this field is an offset from the sequence number indicating the last urgent data byte (16 bits)緊急指標:若 URG 旗標被設定,此欄位即為相對於序號的偏移量,指出最後一個緊急資料位元組的位置(16 位元)
  • Options: The length of this field is determined by the data offset field (from 0 to 320 bits)選項:此欄位的長度由資料偏移欄位決定(0 到 320 位元)
  • Data:Upper-layer protocol (ULP) data (varies in size)資料:上層協定(ULP)資料(大小不定)
Which statement about TCP is correct?關於 TCP,下列哪個敘述正確?